ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Sort ignoring negatives and positives (https://www.excelbanter.com/excel-worksheet-functions/29478-sort-ignoring-negatives-positives.html)

bangbanjo

Sort ignoring negatives and positives
 
I need to sort a column of number values by the value ignoring negatives and
positives. Example take the list:

-5000
-4000
-1500
1500
4000
5000

and sort into this list
-5000
5000
-4000
4000
-1500
1500


Peo Sjoblom

You would need a help column, you can insert a temporary help column and use
a formula like


=ABS(A1)


copy down, select both columns and sort by the help column descending


--
Regards,

Peo Sjoblom

(No private emails please)


"bangbanjo" wrote in message
...
I need to sort a column of number values by the value ignoring negatives
and
positives. Example take the list:

-5000
-4000
-1500
1500
4000
5000

and sort into this list
-5000
5000
-4000
4000
-1500
1500



dominicb


Good evening BangBanjo

The only way I can think of doing this using the Excel sort function is
to have an additional column inserted to use a sort key. If your data
is in column A, starting at A1, put in column B1 =ABS(A1) and copy it
down. This will give the absolute value (ie ignore minuses) and use
this as your sort key. As this column is a formula it will change as
the data in column A changes and could be hidden if required.

Or you could write a macro to do this without the intermediate step...

HTH

DominicB


--
dominicb
------------------------------------------------------------------------
dominicb's Profile: http://www.excelforum.com/member.php...o&userid=18932
View this thread: http://www.excelforum.com/showthread...hreadid=376939


bangbanjo

Thanks I will try that

"dominicb" wrote:


Good evening BangBanjo

The only way I can think of doing this using the Excel sort function is
to have an additional column inserted to use a sort key. If your data
is in column A, starting at A1, put in column B1 =ABS(A1) and copy it
down. This will give the absolute value (ie ignore minuses) and use
this as your sort key. As this column is a formula it will change as
the data in column A changes and could be hidden if required.

Or you could write a macro to do this without the intermediate step...

HTH

DominicB


--
dominicb
------------------------------------------------------------------------
dominicb's Profile: http://www.excelforum.com/member.php...o&userid=18932
View this thread: http://www.excelforum.com/showthread...hreadid=376939




All times are GMT +1. The time now is 03:02 AM.

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