View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Duke Carey Duke Carey is offline
external usenet poster
 
Posts: 1,081
Default Sorting numbers with two decimals

insert a column to either side of your values, then use this formula in the
new column, copying it down as far as needed. Replace the A1 reference with
the address of the first cell in your range

=TEXT(A1,"#####.00.00")

Now sort the two columns on the new column with formulas


"Leslie W." wrote:

Good Morning!

I searched through some previous posts and found some interesting answers to
different sorting questions, however, I could not find one exactly similar to
my situation.

I need to sort the following list:

12345.01
20052.01
12345.02.02
17789.02
17789.01
12345.01.03
12345.02

Excel sorts as follows:
12345.01
12345.02
17789.01
17789.02
20052.01
12345.01.03
12345.02.02

This would need to show in the following order:
12345.01
12345.01.03
12345.02
12345.02.02
17789.01
17789.02
20052.01

I understand the reason why I'm getting a funky sort is because the items
with two decimal points are being treated as text while the others are being
treated as numbers. One way I believe I got Excel 2003 to sort properly was
to create a new column, format it to be text (Format Cells Text), then
paste the row into the row that was previously formatted as text.

My data is saved from a sourse as a .csv file. I tried importing the data,
but it still treated some numbers as text.

Any ideas? Thanks!