AVERAGEIFS TO IGNORE ZEROS

Craig_Moore

Board Regular
Joined
Dec 12, 2018
Messages
64
Office Version
  1. 2019
Platform
  1. Windows
Hi All,

i am using the formula below to give me the average production tonnes but i need to ignore the zeros is the a way for me to add this in to my current calculation?

=IFERROR(AVERAGEIFS(L3_TONNES,DATE,">="&AG23,DATE,"<="&EOMONTH(AG23,0)),"0")

Thanks

Craig
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
I don't believe AVERAGIFS can do what you require. As the AVERAGE function ignores FALSE you will need to average a nested IF formula. You may also need to array enter this formula. If you aren’t familiar with array-entered formulas array enter means the formula must be committed from edit mode by simultaneously pressing and holding down Ctrl and Shift while hitting Enter.
Excel Formula:
=AVERAGE(IF((L3_TONNES<>0)*(DATES>=AG23)*(DATES<=EOMONTH(AG23,0)),L3_TONNES))

I changed your named range DATE to DATES. Excel (365) returns error at my end.
 
Upvote 0
thanks for the reply unfortunately i get an error also, I'm sure I will find some way round it i will just have to play with it for a while

thanks for the response

Craig
 
Upvote 0
Try
=IFERROR(AVERAGEIFS(L3_TONNES,L3_TONNES,"<>0",DATE,">="&AG23,DATE,"<="&EOMONTH(AG23,0)),"0")

Also wondering why you have quote marks around the zero i n the IFERROR value? Don't you want the number zero returned in that case?

unfortunately i get an error
Always a good idea to report exactly what the error is. Could it be a #NAME? error because the suggested formula used the name "DATES" where your name is "DATE"?
 
Upvote 0
Try
=IFERROR(AVERAGEIFS(L3_TONNES,L3_TONNES,"<>0",DATE,">="&AG23,DATE,"<="&EOMONTH(AG23,0)),"0")

Also wondering why you have quote marks around the zero i n the IFERROR value? Don't you want the number zero returned in that case?


Always a good idea to report exactly what the error is. Could it be a #NAME? error because the suggested formula used the name "DATES" where your name is "DATE"?


Hi Peter,

This has helped I'm managing to get the expected results for the dates that have already been inputted
but on the months where i have not data I'm getting a "random" number returned? please see below high lighted in red i would expect this to be 0 as there is no data for those months in the sheet

Also I didn't realise the " " was only for text thanks for the heads up on that

in future i will put on what the error is


thanks for your Reply and help

Craig



MONTHLY TOTAL.xlsx
AGAHAIAJ
21AVERAGE MONTHLY DOZ
22LINE 3LINE 5TUBS
23April36605082214
24May400943132028
25June358047912010
26July333549382027
27August330149632030
28September330149632030
29October330149632030
30November330149632030
31December330149632030
32January330149632030
33February330149632030
34March330149632030
ALL LINES
Cell Formulas
RangeFormula
AH23:AH34AH23=IFERROR(AVERAGEIFS(L3_AMMOUNT,DATE,"<>0"&AG23,DATE,"<="&EOMONTH(AG23,0)),0)
AI23:AI34AI23=IFERROR(AVERAGEIFS(L5_AMMOUNT,DATE,"<>0"&AG23,DATE,"<="&EOMONTH(AG23,0)),"0")
AJ23:AJ34AJ23=IFERROR(AVERAGEIFS(TUBS_AMMOUNT,DATE,"<>0"&AG3,DATE,"<="&EOMONTH(AG3,0)),"0")
Named Ranges
NameRefers ToCells
DATE='ALL LINES'!$A$3:$A$370AH23:AJ34
L3_AMMOUNT='ALL LINES'!$E$3:$E$370AH23:AH34
L5_AMMOUNT='ALL LINES'!$J$3:$J$370AI23:AI34
TUBS_AMMOUNT='ALL LINES'!$O$3:$O$370AJ23:AJ34
 
Upvote 0
Those formulas don't look much at all like I suggested.
Your formulas refer to columns that we cannot see so impossible to investigate.
 
Upvote 0

Forum statistics

Threads
1,214,393
Messages
6,119,261
Members
448,880
Latest member
aveternik

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