ABS and LARGE Problem

tljenkin

Board Regular
Joined
Jun 14, 2007
Messages
147
Hi All,

Please help, I have a list that contains positive and negative numbers. Lets just say 10 cells containing positive and negative cells. I want to use large in an array to reorder the 10 cells, obviously highest to lowest but I want the re-ordered results to show negative signs for those items that were negative.

I used large and ABS and that worked in terms of reordering but all items are now positve. I dont know how to get excel to apply the negative sign to the original negative items.

Please help

Thanks
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
Hi,

Perhaps this array formula** in B1 and then copied down:

=INDEX($A$1:$A$10,MATCH(TRUE,ABS($A$1:$A$10)=LARGE(ABS($A$1:$A$10),ROWS($1:1)),0))

Regards


**Array formulas are not entered in the same way as 'standard' formulas. Instead of pressing just ENTER, you first hold down CTRL and SHIFT, and only then press ENTER. If you've done it correctly, you'll notice Excel puts curly brackets {} around the formula (though do not attempt to manually insert these yourself).</SPAN></SPAN>
 
Upvote 0
Wow, I am speechless, thank you so much! i need to study this formula to understand the logic :)
 
Upvote 0
Hi XOR LX

If you have the same absolute value twice, from one negative and one positive, you'll only catch the first one that appears in the range (twice). Not sure if it's important in this case, but maybe you want to tweak the formula?
 
Upvote 0
Hi XOR LX

If you have the same absolute value twice, from one negative and one positive, you'll only catch the first one that appears in the range (twice). Not sure if it's important in this case, but maybe you want to tweak the formula?

A very good point. Thanks, PGC.

I guess one way (certainly not the most rigorous) would be to add a small increment to ensure uniqueness:

=INDEX($A$1:$A$10,MATCH(TRUE,ABS($A$1:$A$10)+1/(ROW($A$1:$A$10)*10^12)=LARGE(ABS($A$1:$A$10)+1/(ROW($A$1:$A$10)*10^12),ROWS($1:1)),0))

Imagine there's a better method, though. Will have a think.

Regards
 
Upvote 0
Hello.

Amazing formula!

How do I do this on a non contiguous range?

Thanks in advance.

Filipe Caetano
 
Upvote 0
Here's a formula (B1) that will work if the values are integers, and in the same column. The E1 formula is how to adapt it for non-contiguous cells. It still requires the values to be in the same column. Enter the row numbers of the cells you want to evaluate in the 2 array constants.


Book1
ABCDE
11-61-6
2255
3-3-42-4
4-1-3-3
52-2-3-2
6522
7-62-12
80-1-1
9-4121
10-200
115
12
13-6
14
150
16
17-4
18
19-2
Sheet2
Cell Formulas
RangeFormula
B1=INDEX(A:A,MOD(AGGREGATE(14,6,ABS(A$1:A$10)*100+ROW(A$1:A$10),ROWS($B$1:$B1)),100))
E1=INDEX(D:D,MOD(AGGREGATE(14,6,ABS(SUBTOTAL(9,OFFSET($D$1,{1,3,5,7,9,11,13,15,17,19}-1,0)))*100+{1,3,5,7,9,11,13,15,17,19},ROWS($E$1:$E1)),100))


If you have different requirements (non-integers, values not in same column), please let us know. Examples would help.
 
Upvote 0
Thank you very much for replying.
I'll give you an example of what I need.

ABCD
1Subtotal157,97-100,25
2Value110,25-82,41
3Value242,5360,02
4Value35,1957,97
5Subtotal2-54,38-54,38
6Value145,87-48,26
7Value2-100,2545,87
8Subtotal3-48,2642,53
9Value1-25,87-25,87
10Value2-82,4110,25
11Value360,025,19

<tbody>
</tbody>

D1{=INDEX($C$2:$C$12,MATCH(LARGE(ABS($C$2:$C$12)+1/(ROW($C$2:$C$12)*10^12);A2),ABS($C$2:$C$12)+1/(ROW($C$2:$C$12)*10^12);FALSE);1)}

<tbody>
</tbody>

If I rank all numbers using a continuous range I get the results on column D, but I want to be able to do this just for Subtotal rows, so I'm looking for a way to rank only those subtotal values (non integer values).

I'm very sorry for any mistake I have made on the text, english is not my first language. Hope you understand what I need.

Thank you very much in advance.

Best regards
Filipe Caetano
 
Upvote 0

Forum statistics

Threads
1,214,525
Messages
6,120,051
Members
448,940
Latest member
mdusw

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top