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.
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
I'm not comprehending what is being summed. However you can match TODAY() in a range to pull the column to look at.
=MATCH(TODAY(),$B$3:$H$3)
 
Upvote 0
None of that makes any sense, try posting your examples using XL2BB (click the button on the reply toolbar then follow the instructions).

Remember to include the relevant data and the expected results, remove anything that is not relevant to the question and fictionalise any personal / confidential data.
 
Upvote 0
So lets say today is Monday. Only people scheduled to work is (from column A) DA, DC and DL. So I want to make a count of on the Roster (which lists everyone) who is suppose to work on a Monday.
If its Wednesday, only DA, DB is working.
So each shift code works on different days and I want to avoid manual input of formulas each day.

Is there a single formula that can do this?
If today = Sunday then sum L9, L11, L13.
If today = Monday then sum L9, L12, L13.
If today = Tuesday, then sum L9,L12, L13.
If today = Wednesday then sum L9, L10.
If today = Thursday then sum L10, L11, L12
If today = Friday then sum L10, L11, L12
If today = Saturday then sum L10, L11, L13
 
Last edited:
Upvote 0
If what you wrote is correct, then try this
=IF(WEEKDAY(TODAY())=1,SUM(L9,L11,L13),IF(WEEKDAY(TODAY())=2,SUM(L9,L12,L13),IF(WEEKDAY(TODAY())=3,SUM(L9,L12,L13),IF(WEEKDAY(TODAY())=4,SUM(L9,L10),IF(WEEKDAY(TODAY())=5,SUM(L10,L11,L12),IF(WEEKDAY(TODAY())=6,SUM(L10,L11,L12),IF(WEEKDAY(TODAY())=1,SUM(L10,L11,L13))))))))
 
Upvote 0
If what you wrote is correct, then try this
=IF(WEEKDAY(TODAY())=1,SUM(L9,L11,L13),IF(WEEKDAY(TODAY())=2,SUM(L9,L12,L13),IF(WEEKDAY(TODAY())=3,SUM(L9,L12,L13),IF(WEEKDAY(TODAY())=4,SUM(L9,L10),IF(WEEKDAY(TODAY())=5,SUM(L10,L11,L12),IF(WEEKDAY(TODAY())=6,SUM(L10,L11,L12),IF(WEEKDAY(TODAY())=1,SUM(L10,L11,L13))))))))
Thank you very much. This worked for me.
 
Upvote 0
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))
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,337
Members
452,637
Latest member
Ezio2866

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