My X-No working day in the weekend (without offs, holidays, sick leaves etc)

songo

New Member
Joined
Apr 16, 2015
Messages
15
Hello guys,


I am trying to figure out formula that will show number of my work day in week, I don't have standard schedule.
Instead i can work Mon,Tue,OFF,Thu,Fri,OFF,Sun or it can be: Mon,OFF, Tue, HOLIDAY,OFF, Fri,Sat,Sun.
Networkday - only counts total days, workday - also doesn't give what i want.


Like on the table below, 2nd column is final result of formula what i am trying to acomplish.

[TABLE="class: grid, width: 20"]
<tbody>[TR]
[TD]Monday[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]Tuesday
[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD]Wednesday[/TD]
[TD]3[/TD]
[/TR]
[TR]
[TD]OFF[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Friday[/TD]
[TD]4[/TD]
[/TR]
[TR]
[TD]OFF[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Sunday[/TD]
[TD]5[/TD]
[/TR]
[TR]
[TD]Monday[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]HOLIDAY[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Wednesday[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD]Thurday[/TD]
[TD]3[/TD]
[/TR]
[TR]
[TD]OFF[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]OFF[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Sunday[/TD]
[TD]4[/TD]
[/TR]
[TR]
[TD]Monday[/TD]
[TD]1[/TD]
[/TR]
</tbody>[/TABLE]
etc...
 
Upvote 0

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
Yes, this was clearly defined in post #3 .
But if it were not so, your/our formula could be easily adapted
=IF(B2<>"WORK","",COUNTIFS(A$2:A2,">="&MAX(DATE(YEAR(A2),MONTH(A2),1),A2-WEEKDAY(A2,3)),B$2:B2,"WORK"))
A little more compact and two less function calls...

=IF(B2<>"WORK","",COUNTIFS(A$2:A2,">="&MAX(A2-DAY(A2)+1,A2-WEEKDAY(A2,3)),B$2:B2,"WORK"))
 
Upvote 0
That situation should not be able to occur. In Message #3 , the OP said "...this formula will be used for many people and each month will be separate Sheet."
Ah, I see. Somehow, I paid more attention to your phrase "at least not one that looked like it might go on forever" ;)
 
Last edited:
Upvote 0
... And you came essentially to my formula from Post [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=7]#7 [/URL] ; mine has fewer references to A2...
Well, it is a little different (your function does not use MAX for example). However, in looking at the formula you posted in Message #6 (not #7 by the way), it can be simplified a little bit more while removing a function call and a reference to A2 in the process...

=IF(B2<>"WORK","",COUNTIFS(A$2:A2,">="&A2-WEEKDAY(A2,3),B$2:B2,"WORK"))
 
Last edited:
Upvote 0
My bad -- it should read Post #9 .

I have used MIN instead of MAX in order to have fewer references to A2.
I referenced the wrong formula... I forgot we were taking about resetting the count at the beginning of the month (which the OP did not need). The simplified version of your Message #6 formula that I posted in Message #15 still works for the OP's original question though.
 
Upvote 0

Forum statistics

Threads
1,223,992
Messages
6,175,827
Members
452,673
Latest member
LaMiaAvy

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