AVERAGE HH:MM time using OR and AND together within the same formula

LawNapier

New Member
Joined
May 18, 2020
Messages
26
Office Version
  1. 365
Platform
  1. Windows
I am trying to average column D (time results in custom format HH:MM).

I need to only average the rows that meet the criteria.

A:A = APPLE or PEAR
and B:B= RIPE and C:C= GOOD

I need the result to return in custom format HH:MM

ABCD
1APPLERIPEGOOD01:23
2APPLERIPEGOOD15:33
3PEARRIPEGOOD22:00
4PEARROTTENBAD14:47
5APPLEROTTENBAD00:48

Thank you in advance for your help.
 
FormR - Ugh you are right. I thought I had this licked. Let me work with your SUMPRODUCT solution and get back with you. Thanks
 
Upvote 0

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
OK, as long as you understand that is not the same as the average of the times where column A is either Pear OR Apple.

To demonstrate.

Book1
ABCDEFGH
1APPLERIPE01:23:00APPLE12:58:4006:28:0012:58:40
2APPLERIPE15:33:00PEAR
3PEARRIPE22:00:00
Sheet1
Cell Formulas
RangeFormula
F1F1=SUMPRODUCT(SUMIFS(C:C,A:A,E1:E2,B:B,"RIPE"))/SUMPRODUCT(COUNTIFS(A:A,E1:E2,B:B,"RIPE"))
G1G1=SUM(AVERAGEIFS(C:C, A:A,"="&"APPLE", B:B,"="&"RIPE"), AVERAGEIFS(C:C, A:A,"="&"PEAR", B:B,"="&"RIPE"))
H1H1=AVERAGE(C1:C3)


Hi FormR --

The concept example I gave you above was to simplify things to explain my issue.

Below is the actual code in my spreadsheet where I applied your SUMPRODUCT formula to.

I am getting the "There's a problem with this formula. Not trying to type a formula? ERROR" when I try to save the below to a call to run the calculation.

Can you take a look and let me know what you think I have written wrong? I think I have the syntax correct from your example, but not sure.

=SUMPRODUCT(SUMIFS

('RAW DATA'!$P:$P,
'RAW DATA'!$E:$E,$B$5:$B$8,
'RAW DATA'!$K:$K,"INC",
'RAW DATA'!$L:$L,$AG$6,
'RAW DATA'!$N:$N,$AH$4

))/

SUMPRODUCT(COUNTIFS

('RAW DATA'!$E:$E,$B$5:$B$8,
'RAW DATA'!$K:$K,"INC",
'RAW DATA'!$L:$L,$AG$6,
'RAW DATA'!$N:$N,$AH$4

))
 
Upvote 0
This commits for me, I've not checked the logic per se.

Code:
=SUMPRODUCT(SUMIFS('RAW DATA'!$P:$P,'RAW DATA'!$E:$E,$B$5:$B$8,'RAW DATA'!$K:$K,"INC",'RAW DATA'!$L:$L,$AG$6,'RAW DATA'!$N:$N,$AH$4))/SUMPRODUCT(COUNTIFS('RAW DATA'!$E:$E,$B$5:$B$8,'RAW DATA'!$K:$K,"INC",'RAW DATA'!$L:$L,$AG$6,'RAW DATA'!$N:$N,$AH$4))
 
Upvote 0

Forum statistics

Threads
1,216,081
Messages
6,128,696
Members
449,464
Latest member
againofsoul

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