excell sorting question

T

twosix

does anyone know how to do a sort for how close a list of numbers com
to a designated cell with a index number in that cell??

example:

a 39
b 40
c 51
d 44
e 43

sort by being the same or the closest to "44"

results should be:

d 44
e 43
b 40
a 39
c 5
 
D

Dan E

Twosix,

You can add a helper column...

In the column next to that one (assume A1:A5) enter
=ABS(44-A1) and drag down to fill the series.

Select both columns and choose Data -> Sort and sort
according to the helper column.

Dan E
 
D

David McRitchie

You might do this by using a helper column:
and sorting on it. I would use the following which
provides for handling both positive and negative numbers
=ABS(44-ABS(A1))
 
T

twosix

Thanks to you all !!!! your solution worked perfectly
=abs(44-a1) converted the negative numbers to positive numbers. this
allowed me to sort (assending) and determine which numbers were the
same and/or closest to the number being compared to.

thank you for your quick response

twosix
 
D

David McRitchie

Thanks for posting which reply you went with. It also made me
look again at my answer to see that mine was incorrect .
 
Top