Sorting by integer length...

C

Christopher

Hi!

I'm wondering if there is a way in Excel to sort by integer length
instead of integer value...for example...

let's say a set of numbers are entered in wrong order...

1
-3
2
-2
3
-1

the normal excel sort will go by "the value of the integer" and do
this

3
2
1
-1
-2
-3

Is there a way to get excel to sort so the result is like this?:

1
-1
2
-2
3
-3



Thanks,

Neo...
 
D

Dave Peterson

I think I'd use a helper column and sort by that.

If your data starts in A1, then put this formula in B1:
=ABS(A1)+0.1*(A1<0)
and drag down.

I got this with your test data:
1
3.1
2
2.1
3
1.1

Then select all your columns and sort by that helper column. (Delete the helper
column when it's no longer necessary.)
 
C

CLR

Hi Neo..........

With your data in column A, put this formula in B1 and copy
down...........then sort both columns with column B as the key,
ascending.........

=IF(A1>0,A1,A1*-1.1)

Vaya con Dios,
Chuck, CABGx3
 
Top