Sorting "text" numbers

C

Chris

I am sorting a list of numbers (actually telephone
extensions) which need to be formatted as text. When I
sort them I get two separate lists starting over again.

e.g. 1000,1001,1004,2003,3456,...,0456,1003,2455,...

I've check for leading spaces, format differences etc. but
this is not the problem.
 
B

Bernie Deitrick

Chris,

If the cells were formatted after entering the data, the currently entered
values aren't automatically converted from numbers to strings.

Do your sort, then select the first group of cells and run this macro:

Sub MakeText()
For Each myCell In Selection
myCell.Value = "'" & myCell.Value
Next myCell
End Sub

Then redo your sort, and all should work out.

HTH,
Bernie
MS Excel MVP
 
Top