Forum Discussion
Hr
Oct 20, 2022Copper Contributor
Averageifs function divide by zero error
I trying to get the correct average of just the q1 and q3 values using averageifs function. Have looked a lot online but couldn't find a solution. However, someone kindly did help me here on MS commu...
- Oct 20, 2022That is due to the empty cells in your data, to cater for those we need an additional check:
=AVERAGE(IF((H2:H13<>"")*((G2:G13="Q1")+(G2:G13="Q3"))>0,H2:H13,""))
Hr
Oct 21, 2022Copper Contributor
Ok this one works. And I now see why you are not convinced about the divide by two formula. Turns out, it returns the wrong answer if I enter a value in one of the blank cells say 123456 in H3. Just still wish there was a much shorter formula to compute this
JKPieterse
Oct 21, 2022Silver Contributor
I'm afraid not! There might be alternatives, but I doubt if those will be much simpler. You could create a LAMBDA function for this, but I doubt whether it is worth the effort:
https://jkp-ads.com/Articles/Excel-lambda-function-basics.asp
https://jkp-ads.com/Articles/Excel-lambda-function-basics.asp
- HrOct 21, 2022Copper ContributorOk will take a look, thanks!