sort 12 strings into alphabetical order

merlin777

Well-known Member
Joined
Aug 29, 2009
Messages
1,397
Office Version
  1. 2007
I have 12 cells, e.g. A1 to A12, each with a text string (which come from elsewhere in the workbook).

I want a formula to make the 12 strings appear sorted into alphabetical order in a13 to a24.

I've posted the request before including blank cell removal but in spite of some great contributions we never arrived at a solution so I've worked on simplifying the requirement by removing the blanks another way.

All help greatly appreciated!
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
as i say, I need a formula. It's an interactive workbook to be used by other people and the strings are being generated dynamically from other parts of the workbook.
 
Upvote 0
I may be wrong but I don't think that a formula is possible. Do what I suggested above whilst recording a macro,
 
Upvote 0
You could put this CSE formula in A13 and drag down

=INDEX($A:$A, 100*MOD(SMALL(COUNTIF($A$1:$A$12,"<"&$A$1:$A$12)+ROW($A$1:$A$12)/100,ROW(A1)),1), 1)

This needs to be entered with Ctrl-Shift-Enter (Cmd+Return for Mac)
 
Last edited:
Upvote 0
this works when I put it on a new sheet but when i put it on the sheet I need to use it on it doesn't.

Here's what I have. L546 to L548 has the data to be sorted. It is the result of formulae as you can see.

Sheet1

*L
54608:30physiotherapy/Clare
practice car transfers
54709:00physiotherapy/Clare
to make lunch
54809:45physiotherapy/Clare
to make lunch
54910:00physiotherapy/Clare
to make lunch
55016:45physiotherapy/Clare
to practice dressing
55111:30physiotherapy/Nursey Nurse
CHANGE DRESSINGS
55208:00physiotherapy/Mousey Midge
car transfer
55316:45physiotherapy/Custard Cat
to practice dressing
554*
555*
556*
557*
558*
55911:30physiotherapy/Nursey Nurse
CHANGE DRESSINGS
560*
561*
562*
563*
564*
565*
566*
567*
568*
569*

<colgroup><col style="font-weight:bold; width:30px; "><col style="width:589px;"></colgroup><tbody>
</tbody>

Spreadsheet Formulas
CellFormula
L546{=IFERROR(INDEX(blanksrangemon,SMALL((IF(LEN(blanksrangemon),ROW(INDIRECT("1:"&ROWS(blanksrangemon))))),ROW(A1)),1),"")}
L547{=IFERROR(INDEX(blanksrangemon,SMALL((IF(LEN(blanksrangemon),ROW(INDIRECT("1:"&ROWS(blanksrangemon))))),ROW(A2)),1),"")}
L548{=IFERROR(INDEX(blanksrangemon,SMALL((IF(LEN(blanksrangemon),ROW(INDIRECT("1:"&ROWS(blanksrangemon))))),ROW(A3)),1),"")}
L549{=IFERROR(INDEX(blanksrangemon,SMALL((IF(LEN(blanksrangemon),ROW(INDIRECT("1:"&ROWS(blanksrangemon))))),ROW(A4)),1),"")}
L550{=IFERROR(INDEX(blanksrangemon,SMALL((IF(LEN(blanksrangemon),ROW(INDIRECT("1:"&ROWS(blanksrangemon))))),ROW(A5)),1),"")}
L551{=IFERROR(INDEX(blanksrangemon,SMALL((IF(LEN(blanksrangemon),ROW(INDIRECT("1:"&ROWS(blanksrangemon))))),ROW(A6)),1),"")}
L552{=IFERROR(INDEX(blanksrangemon,SMALL((IF(LEN(blanksrangemon),ROW(INDIRECT("1:"&ROWS(blanksrangemon))))),ROW(A7)),1),"")}
L553{=IFERROR(INDEX(blanksrangemon,SMALL((IF(LEN(blanksrangemon),ROW(INDIRECT("1:"&ROWS(blanksrangemon))))),ROW(A8)),1),"")}
L554{=IFERROR(INDEX(blanksrangemon,SMALL((IF(LEN(blanksrangemon),ROW(INDIRECT("1:"&ROWS(blanksrangemon))))),ROW(A9)),1),"")}
L555{=IFERROR(INDEX(blanksrangemon,SMALL((IF(LEN(blanksrangemon),ROW(INDIRECT("1:"&ROWS(blanksrangemon))))),ROW(A10)),1),"")}
L556{=IFERROR(INDEX(blanksrangemon,SMALL((IF(LEN(blanksrangemon),ROW(INDIRECT("1:"&ROWS(blanksrangemon))))),ROW(A11)),1),"")}
L557{=IFERROR(INDEX(blanksrangemon,SMALL((IF(LEN(blanksrangemon),ROW(INDIRECT("1:"&ROWS(blanksrangemon))))),ROW(A12)),1),"")}
L558{=INDEX($L:$L, 100*MOD(SMALL(COUNTIF(noblanksrangemon,"<"&noblanksrangemon)+ROW(noblanksrangemon)/100,ROW(A1)),1), 1)}
L559{=INDEX($L:$L, 100*MOD(SMALL(COUNTIF(noblanksrangemon,"<"&noblanksrangemon)+ROW(noblanksrangemon)/100,ROW(A2)),1), 1)}
L560{=INDEX($L:$L, 100*MOD(SMALL(COUNTIF(noblanksrangemon,"<"&noblanksrangemon)+ROW(noblanksrangemon)/100,ROW(A3)),1), 1)}
L561{=INDEX($L:$L, 100*MOD(SMALL(COUNTIF(noblanksrangemon,"<"&noblanksrangemon)+ROW(noblanksrangemon)/100,ROW(A4)),1), 1)}
L562{=INDEX($L:$L, 100*MOD(SMALL(COUNTIF(noblanksrangemon,"<"&noblanksrangemon)+ROW(noblanksrangemon)/100,ROW(A5)),1), 1)}
L563{=INDEX($L:$L, 100*MOD(SMALL(COUNTIF(noblanksrangemon,"<"&noblanksrangemon)+ROW(noblanksrangemon)/100,ROW(A6)),1), 1)}
L564{=INDEX($L:$L, 100*MOD(SMALL(COUNTIF(noblanksrangemon,"<"&noblanksrangemon)+ROW(noblanksrangemon)/100,ROW(A7)),1), 1)}
L565{=INDEX($L:$L, 100*MOD(SMALL(COUNTIF(noblanksrangemon,"<"&noblanksrangemon)+ROW(noblanksrangemon)/100,ROW(A8)),1), 1)}
L566{=INDEX($L:$L, 100*MOD(SMALL(COUNTIF(noblanksrangemon,"<"&noblanksrangemon)+ROW(noblanksrangemon)/100,ROW(A9)),1), 1)}
L567{=INDEX($L:$L, 100*MOD(SMALL(COUNTIF(noblanksrangemon,"<"&noblanksrangemon)+ROW(noblanksrangemon)/100,ROW(A10)),1), 1)}
L568{=INDEX($L:$L, 100*MOD(SMALL(COUNTIF(noblanksrangemon,"<"&noblanksrangemon)+ROW(noblanksrangemon)/100,ROW(A11)),1), 1)}
L569{=INDEX($L:$L, 100*MOD(SMALL(COUNTIF(noblanksrangemon,"<"&noblanksrangemon)+ROW(noblanksrangemon)/100,ROW(A12)),1), 1)}

<tbody>
</tbody>
Formula Array:
Produce enclosing
{ } by entering
formula with CTRL+SHIFT+ENTER!

<tbody>
</tbody>


Excel tables to the web >> Excel Jeanie HTML 4
 
Upvote 0
I just realised excel converted my $L$546:$L$557 to the name I gave this range. I assume that doesn't make a difference to the outcome.
 
Upvote 0
The A:A is the column where my test data resided. (Actualy A1:A12)
For your lay-out, the formula would be

=INDEX($L:$L, 100*MOD(SMALL(COUNTIF($L$546:$L$549,"<"&$L$546:$L$549)+ROW($L$546:$L$549)/100,ROW(A1)),1), 1)
 
Upvote 0

Forum statistics

Threads
1,213,565
Messages
6,114,338
Members
448,569
Latest member
Honeymonster123

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top