AVERAGEIF over non-contiguous range...there has to be a better way

ZenZilla

New Member
Joined
Jun 26, 2015
Messages
46
I'm trying to average three non-contiguous cells that contain referential formulas, based on the criteria that the values are >0 (I want to ignore 0 values in the average). Everything I can think of either doesn't work or will be stupidly complex. There must be a simple way to use criteria formulas (SUMIF, COUNTIF, AVERAGEIF, etc...) with non-contiguous ranges.

Such a simple problem...Thank you for any assistance you can provide.
 
Here's the logic..

Take any numeric value in A1

=1/(1/A1)

That in itself returns the exact same numeric value of A1
If A1 is say 10
1/10 = 0.10
=1/(0.10)

1/0.10 = 10


Now if A1 is a 0
Then 1/0 = #DIV/0! Error

That's where IFERROR comes in.
=IFERROR(1/(1/A1),"")
If the result of 1/(A1/1) is an Error (A1=0), then return "". Otherwise return the result of 1/(1/A1)

It's a very handy trick for hiding Errors 0's and/or Text results of formulas.
 
Last edited:
Upvote 0

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
This formula works as a replacement, but I'm not sure I understand the logic. Specifically the use of IFERROR and 1/.

I wrote an article on this technique which may be of interest:

IFERROR techniques for excluding certain values from results « EXCELXOR

The key point being that the only (numerical) value for which reciprocation with 1 will produce an error is 0. Re-reciprocation does not change that error result, though of course it will return any value other than 0 back to its original status after the double-reciprocation.

@XOR LX Thanks for the tip! I will change them to the proper ranges and hopefully I will see an increase in the calculation speed

You're welcome.

Regards
 
Upvote 0
Having problems using the averageif function where the range column is formated as TIME and the criteria is a range of times eg. and(>=2:00,<=4:00), and the average range is number of players.
I keep getting the DIV/O error message. How do I solve this problem please?
 
Upvote 0
Perhaps if you showed us your current formula we might be able to help?

Regards
 
Upvote 0

Forum statistics

Threads
1,216,100
Messages
6,128,829
Members
449,471
Latest member
lachbee

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