ABS() treats blanks as 0; is there a workaround for this?

TomCon

Active Member
Joined
Mar 31, 2011
Messages
373
Office Version
  1. 365
Platform
  1. Windows
  2. Mobile
If you put 5, blank, -10 in A1:A3 and then have this formula (blank is a clear cell empty of any content)
=AVERAGE(ABS(A1:A3))
you get answer 5, which is the average of ABS(5,-10,0)

Of course the "regular" AVERAGE function (without the ABS()) just averages the "present" values and does not treat the blank cell "as if it were value 0"

Is there a workaround for this so that i could have blank cells within a range for the formula AVERAGE(ABS()) and get a result of the Average of the "cells with values" and not treat empty cells as if they were value 0? I have tried IF statements that evaluate to "" or #N/A if the cell is empty but it also does not work. What a pernicious behavior!

If you can think of a workaround for this behavior of ABS() please let me know. Thank you.
 
Yes, that does it. Thank you! I cannot exactly work out in my mind why this works, doesn't the output vector also still have some spaces with "" in it that correspond to blanks in the input? Oh well, it works!!!!
Yes, thanks, this works too. Possibly a bit more intuitive. I guess the system will not let me mark two responses as "correct solution". But, thanks!
Perhaps changing "Testing for Blanks" this way is a bit more intuitive? (and shorter)

Excel Formula:
=AVERAGE(IF(A1:A3<>"",ABS(A1:A3)))
 
Upvote 0

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
Another way would have been be to remove the blanks altogether

Excel Formula:
=AVERAGE(ABS(FILTER(A1:A3,A1:A3<>"")))
 
Upvote 0

Forum statistics

Threads
1,215,061
Messages
6,122,921
Members
449,094
Latest member
teemeren

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