I see a lot of incorrect conclusions here. Please pay close attention to the details.
-----
The #DIV/0 error arises because AVERAGEIFS does not find any numeric data to average.
That is because either the data is text, or there is no row that meets all of the conditions, or both.
In your case, it is probably because the data is text.
Nevertheless, AVERAGEIFS can always return #DIV/0. So it is always prudent to write:
=IFERROR(AVERAGEIFS($C$1:$C$7, $A$1:$A$7, A1, $B$1:$B$7, B1), 0)
That returns zero when there is no data to average.
Note: In general, it is better to enter limited ranges like $C$1:$C$100 instead of whole-column ranges like C:C. The latter form might cause Excel to process as much as 1+ million rows of data and to create internal temp arrays of as much as 1+ million entries. You can change $100 to $1000, $10000, etc -- any reasonable number of rows that covers the most data that you reasonably expect to ever have.
-----
The format of a cell has nothing to do with it, __if__ the values are numeric.
AVERAGEIFS works just fine if the numeric data is formatted as dd:hh:mm or [h]:mm -- although "dd" is a risky format specifier to use, as I explained.
The problem is: ISNUMBER returns FALSE.
So the values are text, not numeric, despite appearances and despite the cell format.
You need to correct that. Not by changing the cell format, but by changing the data.
If you enter data in the form x:y:z, Excel interprets that as x hours y minutes z seconds, __not__ x days y hours z minutes.
But that is still numeric data. It is just the wrong numeric data. You would need to correct that anyway.
However, somehow your data was entered as text, even if the cells are formatted as numeric. It happens!
One way to correct both problems is:
1. In a parallel column, enter formulas of the following form, assuming that numeric data was entered in the form x:y:z that you intended to represent x days y hours z minutes.
=IF(ISNUMBER(C1), INT(C1*24)+MOD(C1*24,1)*60/24, LEFT(C1,FIND(":",C1)-1) + MID(C1,FIND(":",C1)+1,5))
formatted as d:hh:mm , if you insist.
2. Format column C as d:hh:mm , if you insist.
3. Copy the parallel column, and paste-special-value into column C.
4. Delete the values in the parallel column.
------------------------------------------------------------------------------------------------------------------------------
Joeu2004 - Thanks for the response. That is a lot to unpack so here are my responses.
COMMENT 1:
The below is the entire AVERAGEIFS formula that I am using. If you look at the rows colored
red you can see I am trying to mimic an OR operation.
Is this the correct way to do this with an AVERAGEIFS formula?
By running each AVERAGEIFS separately, the first three AVERAGEIFS find rows that match the criteria, but the last AVERAGIFS finds no rows that match. So there are some rows that match. Shouldn't the formula average the rows that it found instead of returning "0"?
COMMENT 2:
I added the IFERROR() wrapper as you suggested. I now get "0" as the result when I run the formula. As outlined above, if I have confirmed the first three AVERAGEIFS find
rows that match criteria and the last one doesn't, there are still rows to average. I'm wondering why it is returning "0".
COMMENT 3:
'RAW DATA'!$O4:$O150000 is the column that I am averaging. For all the column ranges, I reduced the column sizes down from X:X as you suggested.
COMMENT 4:
ISNUMBER returns FALSE on cells in 'RAW DATA'!$O4:$O150000. These cells have the below formula in them to provide the row DD:HH:MM value. It is checking for some conditions based on cell values to determine how to calculate the final result DD:HH:MM result.
=IF(I98769<>"closed complete",TEXT(NOW()-F98769,"DD:HH:MM"),IF(G98769="",TEXT(H98769-F98769,"DD:HH:MM"),TEXT(G98769-F98769,"DD:HH:MM")))
I understand what you want me to do with the parallel column to get the column back to the correct numeric state behind the scenes, but that will overwrite the above formula..so I am a bit stuck there.
=IF(ISNUMBER(C1), INT(C1*24)+MOD(C1*24,1)*60/24, LEFT(C1,FIND(":",C1)-1) + MID(C1,FIND(":",C1)+1,5))
SUBJECT PROBLEM FORMULA
--------------------------------------------------------------------
=IFERROR(SUM(
AVERAGEIFS('RAW DATA'!$O4:$O150000,
'RAW DATA'!$E4:$E150000,"="&$B$5,
'RAW DATA'!$K4:$K150000,"="&"INC",
'RAW DATA'!$L4:$L150000,"="&$AG$6,
'RAW DATA'!$N4:$N150000,"="&$AH$4),
AVERAGEIFS('RAW DATA'!$O4:$O150000,
'RAW DATA'!$E4:$E150000,"="&$B$6,
'RAW DATA'!$K4:$K150000,"="&"INC",
'RAW DATA'!$L4:$L150000,"="&$AG$6,
'RAW DATA'!$N4:$N150000,"="&$AH$4),
AVERAGEIFS('RAW DATA'!$O4:$O150000,
'RAW DATA'!$E4:$E150000,"="&$B$7,
'RAW DATA'!$K4:$K150000,"="&"INC",
'RAW DATA'!$L4:$L150000,"="&$AG$6,
'RAW DATA'!$N4:$N150000,"="&$AH$4),
AVERAGEIFS('RAW DATA'!$P4:$P150000,
'RAW DATA'!$E4:$E150000,"="&$B$8,
'RAW DATA'!$K4:$K150000,"="&"INC",
'RAW DATA'!$L4:$L150000,"="&$AG$6,
'RAW DATA'!$N4:$N150000,"="&$AH$4)
),0)