Dual count if statement (two cells)

claven123

Board Regular
Joined
Sep 2, 2010
Messages
83
Office Version
  1. 365
Platform
  1. Windows
  2. MacOS
I have two colums of data, a time is say A1 and a unit name in A2, 150 or so rows of this.

Currently I'm doing a count if statement on the time portion.
Code:
=COUNTIFS(B250:B417,">=17:00",B250:B417,"<=17:59")

This gives me the count for that time period, I have one for the 24 hours in a day, works great.

I need to make a count if statement to include the parameters of the time and the unit.

The output I'm looking for is GSU had 12 events during the 5pm time frame.

Code:
=COUNTIFS(B250:B417,">=17:00",B250:B417,"<=17:59") AND ("GSU")(

Thanks,

D
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
I have two colums of data, a time is say A1 and a unit name in A2, 150 or so rows of this.

Currently I'm doing a count if statement on the time portion.
Code:
=COUNTIFS(B250:B417,">=17:00",B250:B417,"<=17:59")

This gives me the count for that time period, I have one for the 24 hours in a day, works great.

I need to make a count if statement to include the parameters of the time and the unit.

The output I'm looking for is GSU had 12 events during the 5pm time frame.

Code:
=COUNTIFS(B250:B417,">=17:00",B250:B417,"<=17:59") AND ("GSU")(

Thanks,

D

try:

=COUNTIFS(B250:B417,">=17:00",B250:B417,"<=17:59",unitcolumn,"GSU")
 
Upvote 0
I get an #NAME? error.....

Then I used AND
COUNTIFS(B250:B417,">=12:00",B250:B417,"<=12:59")AND("GSU") Excel says error and suggest this...

=COUNTIFS(B250:B417,">=12:00",B250:B417,"<=12:59")*AND("GSU")

Which gives me a #VALUE! error.

I feel I need to define the range of cells to search for the "GSU" so I added *AND(B250:B417,"GSU") at the end and now get the #VALUE! error.


D
 
Upvote 0
I get an #NAME? error.....

Then I used AND
COUNTIFS(B250:B417,">=12:00",B250:B417,"<=12:59")AND("GSU") Excel says error and suggest this...

=COUNTIFS(B250:B417,">=12:00",B250:B417,"<=12:59")*AND("GSU")

Which gives me a #VALUE! error.

I feel I need to define the range of cells to search for the "GSU" so I added *AND(B250:B417,"GSU") at the end and now get the #VALUE! error.


D

you have to change the 'unitcolumn' in the formula to the actual column where you match GSU..
 
Upvote 0
you have to change the 'unitcolumn' in the formula to the actual column where you match GSU..
... and the rows have to match the rows used for the time.

So if the time is in column B and the units are in column C it would be something like


=COUNTIFS(B250:B417,">=17:00",B250:B417,"<=17:59",C250:C417,"GSU")
 
Last edited:
Upvote 0
Code:
[COLOR=#333333]=COUNTIFS(B250:B417,">=17:00",B250:B417,"<=17:59",C250:C417,"GSU")[/COLOR]

That did the trick....

I was working towards that direction, the last thing I tried was using the two column range B250:C417 and it wouldn't work.

Tried to do this with a pivot table, didn't work either.


Thanks

D
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,289
Members
452,631
Latest member
a_potato

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