Extract largest value from array regardless of sign and ignoring errors

amclay6

New Member
Joined
Jul 10, 2022
Messages
4
Office Version
  1. 2021
Platform
  1. Windows
Hello,

I am trying the get the largest value, positive or negative, from an array.
e.g. (-1.27, #VALUE!, 0.12, -0.54)
For the above case I want the answer to be -1.27.

I have used the following formula however I keep getting an error.
=INDEX(C66:F66,MATCH(AGGREGATE(4,6,ABS(C66:F66)),ABS(C66:F66),0))

For some reason the ABS function in the AGGREGATE function doesn't work.

Any solutions??
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
Do you need AGGREGATE() for this? Try
Excel Formula:
=MAX(ABS(C66:F66))
 
Upvote 0
test.xlsx
CDEFGH
65
66-1.27#VALUE!0.12-0.54-1.27
67
Sheet1
Cell Formulas
RangeFormula
D66D66=E66+D64
H66H66=IF(ABS(AGGREGATE(5,2,C66:F66))>ABS(AGGREGATE(4,2,C66:F66)),AGGREGATE(5,2,C66:F66),AGGREGATE(4,2,C66:F66))
 
Upvote 0
If you want to stick with that previous method, you could write that more efficiently as
Excel Formula:
=LET(a,AGGREGATE(5,6,C66:F66),b,AGGREGATE(4,6,C66:F66),IF(-a>b,a,b))

Here is another approach you could also consider

22 07 11.xlsm
CDEFGH
66-1.27#VALUE!0.12-0.54-1.27
+- Max
Cell Formulas
RangeFormula
H66H66=INDEX(SORTBY(C66:F66,IFERROR(ABS(C66:F66),0),-1),1)
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,840
Messages
6,121,895
Members
449,058
Latest member
Guy Boot

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