Average If-Then-Else

Grandma8

Board Regular
Joined
Jun 29, 2010
Messages
105
Office Version
  1. 365
Platform
  1. Windows
Example:

If P25:P50 is greater than 0, then average P25:P5, else 0
 
Example:

If P25:P50 is greater than 0, then average P25:P5, else 0

One of:

=AVERAGEIF(P25:P50,">0")

=SUMIF(P25:P50,">0")/INDEX(FREQUENCY(P25:P50,0),2)

Control+shift+enter, not just enter:

=AVERAGE(IF(ISNUMBER(P25:P50),IF(P25:P50>0,P25:P50)))
 
Last edited:
Upvote 0
Example:

If P25:P50 is greater than 0, then average P25:P5, else 0
Try one of these...

If you're using Excel 2007 or later:

=AVERAGEIF(P25:P50,">0")

This array formula** will work in any version of Excel:

=AVERAGE(IF(P25:P50>0,P25:P50))

** array formulas need to be entered using the key
combination of CTRL,SHIFT,ENTER (not just ENTER).
Hold down both the CTRL key and the SHIFT key
then hit ENTER.
 
Upvote 0
Thank you! I used the last suggestion and it works just fine.

One of:

=AVERAGEIF(P25:P50,">0")

=SUMIF(P25:P50,">0")/INDEX(FREQUENCY(P25:P50,0),2)

Control+shift+enter, not just enter:

=AVERAGE(IF(ISNUMBER(P25:P50),IF(P25:P50>0,P25:P50)))
 
Upvote 0
I also used your THIRD Formula and it worked perfectly! Thanks!!

Can you please explain why Ctrl + Shift + Enter? Also how to implement it to a series of rows. I have to go to each of the cells & do Ctrl + Shift + Enter. Any solution to this?

One of:

=AVERAGEIF(P25:P50,">0")

=SUMIF(P25:P50,">0")/INDEX(FREQUENCY(P25:P50,0),2)

Control+shift+enter, not just enter:

=AVERAGE(IF(ISNUMBER(P25:P50),IF(P25:P50>0,P25:P50)))
 
Upvote 0
I also used your THIRD Formula and it worked perfectly! Thanks!!

Can you please explain why Ctrl + Shift + Enter? Also how to implement it to a series of rows. I have to go to each of the cells & do Ctrl + Shift + Enter. Any solution to this?

Each of these formulas is a single cell conditional average formula:
https://dl.dropboxusercontent.com/u/65698317/Abhayk%20conditional%20average.xlsx

For control+shift+enter, read on "array formula" in Excel's hep file, reachable via the question mark on the ribbon.
 
Upvote 0

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