Adjust Average If Formula

dunmore83

Well-known Member
Joined
Aug 24, 2011
Messages
540
Hi,

I need to adjust the following formula so it only returns the average for cells in column AG12:AG377 which have a value (i.e. ISNUMBER)

{=AVERAGE(IF(('Milk-Cows-Day'!$D$12:$D$377>=EDATE($G20,0))*('Milk-Cows-Day'!$D$12:$D$377<=EOMONTH($G20,0)),'Milk-Cows-Day'!$AG$12:$AG$377,""))}

Currently it is return the average to include all blank cell values in AG12:AG377

Any helpers ??
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
Hi,

Empty or blank cells are usually ignored by the AVERAGE function.

When you say "blank cell values", do you mean something else?

Matty
 
Upvote 0
Thanks for your reply.

No - the cells are blank.

For example in the month of February 2018 the sum of the values in the first 4 days is 164 (the other 24 cells in column AG for Feb are still blank) & the formula is returning 5.86 as the average (i.e. 164/28)
 
Upvote 0
Just add a further test to the formula, like:

Code:
[COLOR=#333333]=AVERAGE(IF('Milk-Cows-Day'!$D$12:$D$377>=EDATE($G20,0),IF('Milk-Cows-Day'!$D$12:$D$377<=EOMONTH($G20,0),[/COLOR][COLOR=#ff0000]IF(ISNUMBER('Milk-Cows-Day'!$AG$12:$AG$377)[/COLOR][COLOR=#333333],[/COLOR][COLOR=#333333]'Milk-Cows-Day'!$AG$12:$AG$377))))[/COLOR]

Array entered, i.e. with CTRL+SHIFT+ENTER.

Matty
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,910
Messages
6,175,320
Members
452,635
Latest member
laura12345

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