AVERAGEIFS returns #div/0 but how do I make it just use zero?

loveland517

New Member
Joined
Jan 17, 2022
Messages
4
Office Version
  1. 365
Platform
  1. Windows
  2. Mobile
  3. Web
The following formula returns "#div/0"

=AVERAGEIFS(FILTERED!O:O,FILTERED!H:H,">="&TIME(0,0,0),FILTERED!H:H,"<"&TIME(7,0,0),FILTERED!O:O,">8")+AVERAGEIFS(FILTERED!O:O,FILTERED!H:H,">="&TIME(23,0,0),FILTERED!H:H,"<"&TIME(24,0,0),FILTERED!O:O,">8")

I understand the cause is due to the first argument in the formula...

=AVERAGEIFS(FILTERED!O:O,FILTERED!H:H,">="&TIME(0,0,0),FILTERED!H:H,"<"&TIME(7,0,0),FILTERED!O:O,">8")

...having no results returned (BACKGROUND: in the "FILTERED" sheet there are is no data to average in the O column that occurred from midnight to 7am that took over 8 hours)


How use I (within the same formula) express that it should just use "0" if the AVERAGEIFS formula returns "#div/0"?
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
Can you not just wrap your formula in if error .

=iferror(your formula,0)
 
Upvote 0
IFERROR

IFERROR ( Formula , 0 )
 
Upvote 0
Literally two seconds after posting I realized Not to wrap the entire formula, just the first part and it worked fine! THANK YOU ALL FOR BEING SO QUICK TO HELP ON THE WEEKEND!
 
Upvote 0
Your welcome.

Thanks for your feedback.
 
Upvote 0

Forum statistics

Threads
1,214,834
Messages
6,121,874
Members
449,056
Latest member
ruhulaminappu

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