ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Sortin Numbers as Text: How? (https://www.excelbanter.com/excel-programming/286563-sortin-numbers-text-how.html)

William C. Smith

Sortin Numbers as Text: How?
 
No mater what I do Excel in its infinite wisdom sorts numbers as numbers. I
want it to sort the numbers as text. I have not tried prefixing the entered
numbers with an "'". The data comes from another application as text. In my
version of Excel (Excell 2000 (9.0.3821 SR1), the options button ot the
Data/Sort menue will not accept new custom sort orders. Is there a way to
sort text numbers as text?

Edwin Tam (MS MVP)

Sortin Numbers as Text: How?
 
I think the only way is to add the "'" character at the front of the numeric values to force Excel to think of them as text

To quickly process all cells and add the prefix character, you may use the following macro. First select the range of cells which contains the numbers and then run the macro

Sub convert_to_text(
Dim cell As Objec
For Each cell In Selection.Cell
If IsNumeric(cell) Then cell.Value = "'" & cell.Valu
Nex
End Su


----- William C. Smith wrote: ----

No mater what I do Excel in its infinite wisdom sorts numbers as numbers. I
want it to sort the numbers as text. I have not tried prefixing the entered
numbers with an "'". The data comes from another application as text. In my
version of Excel (Excell 2000 (9.0.3821 SR1), the options button ot the
Data/Sort menue will not accept new custom sort orders. Is there a way to
sort text numbers as text


Rocky McKinley

Sortin Numbers as Text: How?
 
To sort numbers as text (as below) the range the numbers are in must be
formatted as text. If you have already entered the data then you must
either re-enter it or,

Select menu item:
Data / Text to Columns - then select next / next and then select text in
the last screen then /Finish.
I'm not sure if Excel 2000 has this feature I'm running Excel 2002.

1
10
11
12
13
14
15
16
17
18
19
2
20
21
22


--
Regards,
Rocky McKinley


"William C. Smith" <wcsmithx*xieee.org wrote in message
...
No mater what I do Excel in its infinite wisdom sorts numbers as numbers.

I
want it to sort the numbers as text. I have not tried prefixing the

entered
numbers with an "'". The data comes from another application as text. In

my
version of Excel (Excell 2000 (9.0.3821 SR1), the options button ot the
Data/Sort menue will not accept new custom sort orders. Is there a way to
sort text numbers as text?




William C. Smith

Sortin Numbers as Text: How?
 
Thank you, The macro works and I can sort numbers as text




?B?RWR3aW4gVGFtIChNUyBNVlAp?= wrote in
:

I think the only way is to add the "'" character at the front of the
numeric values to force Excel to think of them as text.

To quickly process all cells and add the prefix character, you may use
the following macro. First select the range of cells which contains
the numbers and then run the macro.



William C. Smith

Sortin Numbers as Text: How?
 
Thank you Rocky. Windows 2000 does have the Text to Columns feature and it
works!


"Rocky McKinley" wrote in
:

To sort numbers as text (as below) the range the numbers are in must
be formatted as text. If you have already entered the data then you
must either re-enter it or,

Select menu item:
Data / Text to Columns - then select next / next and then select
text in the last screen then /Finish.
I'm not sure if Excel 2000 has this feature I'm running Excel 2002.




All times are GMT +1. The time now is 06:48 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com