How can I use a formula to sort text values?

stuckagain22

Board Regular
Joined
Aug 4, 2006
Messages
183
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?
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.

mikerickson

MrExcel MVP
Joined
Jan 15, 2007
Messages
24,210
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
183
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,210
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)),"")
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,164,659
Messages
5,838,645
Members
430,559
Latest member
jm5498

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