Countifs formula for different days of the week?

gd6noob

Board Regular
Joined
Oct 20, 2017
Messages
170
Office Version
  1. 2016
Platform
  1. Windows
Im trying to get some headcount going on and heres the issue.

There are different shiftcodes and the days they are scheduled to work.
1595551478082.png


As you can see from below img, current day is Friday, which means DB, DN, DC shifts are only scheduled to work for dayshift. I want to know if there is a single formula to sum up the total depending on what day today is into cell L4 or is this only manually done only?
1595552087094.png


As you see in the img above, column L9, my formula is
VBA Code:
=COUNTIFS(Roster!$E:$E,Attendance!$A$1,Roster!$G:$G,"DA*")
, so this is also incorrect.

I think there is 2 ways to approach this but not sure how the formula would work.
1 - formula in L4 to sum L9 to L13 depending on day of the week.
2 - formula to count the number of people in L9 to L13 depending on the day, then I can sum L9 to L13 to have the correct data.

If anyone has any idea on how I can approach this, would greatly be appreciated.


Thanks in advanced.
 
Is this easier to follow? The last part of the formula in my earlier reply mimics the weekday table below, days are numbered 1 (sunday) to 7 (saturday).

zgadson 21-7-20.xlsx
GHIJKL
716
8Weekday#of AA
912349
10456711
1115675
1223560
1312374
Sheet3
Cell Formulas
RangeFormula
L7L7=SUMPRODUCT($L$9:$L$13*(WEEKDAY(TODAY())=$G$9:$J$13))
Thank you, way easier to understand..
 
Upvote 0

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
Now that you can follow how the formula is working, if you look at the array in the formula, you will see that it matches the rows in the table, I've set alternating rows in a bold font to make them easier to identify.

=SUMPRODUCT($L$9:$L$13*(WEEKDAY(TODAY())={1,2,3,4;4,5,6,7;1,5,6,7;2,3,5,6;1,2,3,7}))

In the array, commas are used to separate the items in the row, a semicolon is used to start a new row.
 
Upvote 0
Now that you can follow how the formula is working, if you look at the array in the formula, you will see that it matches the rows in the table, I've set alternating rows in a bold font to make them easier to identify.

=SUMPRODUCT($L$9:$L$13*(WEEKDAY(TODAY())={1,2,3,4;4,5,6,7;1,5,6,7;2,3,5,6;1,2,3,7}))

In the array, commas are used to separate the items in the row, a semicolon is used to start a new row.
I modified your formula to to refer today to user input date and works good.
Code:
=SUMPRODUCT($K$13:$K$17*(WEEKDAY(Dashboard!$I$3)={1,2,3,4;4,5,6,7;1,5,6,7;2,3,5,6;1,2,3,7}))

How would I count the number of people who are in but not scheduled. I tried edit the "=" before the array to "<>" but that was incorrect.
 
Upvote 0
Sum all of the numbers then subtract the ones that should be there, with the previous formula in K4,

=SUM(K13:K17)-K4
 
Upvote 0
Sum all of the numbers then subtract the ones that should be there, with the previous formula in K4,

=SUM(K13:K17)-K4
Is there a way without having to manually do that? Your sumproduct worked and thought there might be something similar....
 
Upvote 0
That's not manual, it utilises the existing sumproduct formula in K4.

If the sumproduct formula in K4 tells you that there are 20 scheduled and there are actually a total of 26 in (sum of K13:K17) then the number of people not scheduled is 6.
26 (total) - 20 (scheduled)
 
Upvote 0

Forum statistics

Threads
1,214,636
Messages
6,120,669
Members
448,977
Latest member
moonlight6

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