How can I use a formula to sort text values?

stuckagain22

Board Regular
Joined
Aug 4, 2006
Messages
182
I have a sheet that I want to auto sort the data in one column into another column.

In Example:

If column A contains:

peach
apple
orange

I want column B to then show:

apple
orange
peach

Is there anyway to do this using a function/formula?
 

Some videos you may like

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.

mikerickson

MrExcel MVP
Joined
Jan 15, 2007
Messages
23,914
In C1 (fill down)
=IF(ISBLANK(A1),300,CODE(A1))

In column B
=INDEX(A:A,MATCH(SMALL(C:C,ROW()),C:C,0),1)
 

stuckagain22

Board Regular
Joined
Aug 4, 2006
Messages
182
Thanks, but this only indexes the value of the first text character. If there are several values that start with the same character, then they would not be alphabetical ie:

peach
pear
pomegranate
 

Aladin Akyurek

MrExcel MVP
Joined
Feb 14, 2002
Messages
85,201
Thanks, but this only indexes the value of the first text character. If there are several values that start with the same character, then they would not be alphabetical ie:

peach
pear
pomegranate

If you have already installed the free morefunc.xll add-in...
Book5
ABCD
15
2peachapple
3pearcranberry
4pomegranatepeach
5applepear
6cranberrypomegranate
7 
Sheet1


C1:

=COUNTA(A2:A6)

C2, copied down:

=IF(ROWS($C$2:C2)<=$C$1,INDEX(VSORT($A$2:$A$6,$A$2:$A$6,1),ROWS($C$2:C2)),"")
 

Watch MrExcel Video

Forum statistics

Threads
1,122,867
Messages
5,598,542
Members
414,245
Latest member
allyciv

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
Top