Count IFs Formula With Dates

Sparda142

Board Regular
Joined
Dec 19, 2018
Messages
52
Hello,


Currently i'm using the following formula below to identify how many shifts are scheduled by criteria by day. Currently i have to change the row letter for the column each time. is there a simpler way of doing this?

=COUNTIF(B2:B4,A7)

Example:

[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD][/TD]
[TD]a[/TD]
[TD]b[/TD]
[TD]c[/TD]
[TD]d[/TD]
[TD]e[/TD]
[TD]f[/TD]
[TD]g[/TD]
[TD]h[/TD]
[TD]i[/TD]
[TD]j[/TD]
[TD]k[/TD]
[TD]l[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]Names and Dates[/TD]
[TD]7/21/2019[/TD]
[TD]7/22/2019[/TD]
[TD]7/23/2019[/TD]
[TD]7/24/2019[/TD]
[TD]7/25/2019[/TD]
[TD]7/26/2019[/TD]
[TD]7/27/2019[/TD]
[TD]7/28/2019[/TD]
[TD]7/29/2019[/TD]
[TD]7/30/2019[/TD]
[TD]7/31/2019[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]John[/TD]
[TD]1:00 PM-2:00 PM[/TD]
[TD]4:00 PM-5:00 PM[/TD]
[TD]2:00 PM-3:00 PM[/TD]
[TD]1:00 PM-2:00 PM[/TD]
[TD]4:00 PM-5:00 PM[/TD]
[TD]2:00 PM-3:00 PM[/TD]
[TD][/TD]
[TD]1:00 PM-2:00 PM[/TD]
[TD]4:00 PM-5:00 PM[/TD]
[TD]1:00 PM-2:00 PM[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]joe[/TD]
[TD]4:00 PM-5:00 PM[/TD]
[TD]1:00 PM-2:00 PM[/TD]
[TD]2:00 PM-3:00 PM[/TD]
[TD]5:00 PM-6:00 PM[/TD]
[TD][/TD]
[TD]1:00 PM-2:00 PM[/TD]
[TD]1:00 PM-2:00 PM[/TD]
[TD]4:00 PM-5:00 PM[/TD]
[TD]3:00 PM-4:00 PM[/TD]
[TD]3:00 PM-4:00 PM[/TD]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PM[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]11[/TD]
[TD]5:00 PM-6:00 PM[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]12[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]13[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]14[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]15[/TD]
[TD][/TD]
[TD]7/22/2019[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]16[/TD]
[TD][/TD]
[TD]=COUNTIF(C2:C4,A16)
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]17[/TD]
[TD]10:00 AM-11:00 AM[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]18[/TD]
[TD]2:00 PM-3:00 PM[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]19[/TD]
[TD]3:00 PM-4:00 PM[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]20[/TD]
[TD]4:00 PM-5:00 PM[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]21[/TD]
[TD]7:00 PM-8:00 PM[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
Not sure it's much easier, but you could use
=COUNTIF(INDEX($B$2:$K$4,0,MATCH($B$6,$B$1:$L$1,0)),A7)
Changing the value in red for each section
 
Upvote 0
Not sure it's much easier, but you could use
=COUNTIF(INDEX($B$2:$K$4,0,MATCH($B$6,$B$1:$L$1,0)),A7)
Changing the value in red for each section

The formula would work however the actual date range is from 7/22/2019 - 12/1/2019. I would need to change the the number in red 132 times
 
Upvote 0
It maybe possible to do something with OFFSET, but I've no idea how.
 
Upvote 0

Forum statistics

Threads
1,223,889
Messages
6,175,224
Members
452,620
Latest member
dsubash

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