Workday returning a Saturday

realPrincessApril

New Member
Joined
Jul 5, 2021
Messages
20
Office Version
  1. 365
Platform
  1. Windows
Hi all,

I thought I understood the Workday function, but apparently not. If my ref date is in B34 and holidays in lookup table, I thought this would return the first workday of the month:

Excel Formula:
=WORKDAY.INTL($B$34,1,1,'Unit Lookups'!$A$21:$A$33)

For ref date 1/1/2022 it returns Monday 1/3/2022 as first workday (great).
But if I change ref date to 2/1/2022, the formula returns Wednesday 2/2/2022 rather than Tuesday 2/1/2022 (whoops). I can get the formula to return 2/1/22 for ref date 2/1/22 if I change the days offset in the formula from 1 to 0, but then that would return incorrectly for January. (2/1/22 is not a holiday in my lookup table).

So I'm wondering if there is an issue with my reference to the weekends. I had thought 1 was the default code for Sat/Sun, which I am using as the weekends. Could someone kindly help me understand what I'm missing? Thank you so much! :)
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
Upvote 0
Hi Dave,

Your second formula looks like what I tried (but maybe I'm just not seeing the difference). Here is a sample minisheet that shows that the second formula seems to work well for first workday in 1/22 but not 2/22 (A11 should return 2/1 rather than 2/2 as the first workday in Feb 2022). I'm having trouble seeing my error if you could help. Thanks so much. :)

minisheet workday.xlsx
ABCDEF
1HOLIDAYS 2022
2January 2022DateHolidayDay
3DateDay1/17/22Martin Luther King DayMonday
41/3Mon5/30/22Memorial DayMonday
56/20/22Juneteenth (Observed)Monday
67/4/22Independence DayMonday
79/5/22Labor DayMonday
810/11/22National Coming Out DayTuesday
9February 202211/24/22Thanksgiving DayThursday
10DateDay11/25/22Day after ThanksgivingFriday
112/2Wed12/26/22Christmas Day (Observed)Monday
1212/30/22New Year's Day (Observed)Friday
13Extra line if needed
14Extra line if needed
15Extra line if needed
Sheet1
Cell Formulas
RangeFormula
A4,A11A4=WORKDAY.INTL(A2,1,1,$D$3:$D$15)
B4,B11B4=A4
F3:F12F3=D3
 
Upvote 0
Try this in A4: =WORKDAY.INTL(A2,1,1,$D$3:$D$15)

in A11: =WORKDAY.INTL(A9-DAY(A9),1,1,$D$3:$D$15)
 
Upvote 0
Cool Phuoc. That second formula looks more flexible (seems to work for both months). Am I correct in assuming that formula should work for all months of all years, assuming I correctly point to the ref cell and update the offset day?

Also, is there a handy way to copy this function down to generate the whole month (where the blue cells are)? I can't seem to get Excel to recognize the pattern when I use the crosshair thing. I tried to select the first few days of Feb and copy down with the crosshair, but it repeats the 1-3 pattern rather than continuing down the numbering.

minisheet workday.xlsx
ABCDEF
1HOLIDAYS 2022
2January 2022DateHolidayDay
3DateDay1/17/22Martin Luther King DayMonday
41/3Mon5/30/22Memorial DayMonday
56/20/22Juneteenth (Observed)Monday
67/4/22Independence DayMonday
79/5/22Labor DayMonday
810/11/22National Coming Out DayTuesday
9February 202211/24/22Thanksgiving DayThursday
10DateDay11/25/22Day after ThanksgivingFriday
112/1Tue12/26/22Christmas Day (Observed)Monday
122/2Wed12/30/22New Year's Day (Observed)Friday
132/3ThuExtra line if needed
14SatExtra line if needed
15SatExtra line if needed
16Sat
17Sat
18Sat
19Sat
20Sat
21Sat
22Sat
23Sat
24Sat
25Sat
26Sat
27Sat
28Sat
29Sat
30Sat
31
Sheet1
Cell Formulas
RangeFormula
A4A4=WORKDAY.INTL(A2-DAY(A2),1,1,D3:D15)
B4,B11:B30B4=A4
F3:F12F3=D3
A11A11=WORKDAY.INTL(A9-DAY(A9),1,1,D3:D15)
A12A12=WORKDAY.INTL(A9-DAY(A9),2,1,D3:D15)
A13A13=WORKDAY.INTL(A9-DAY(A9),3,1,D3:D15)
 
Upvote 0
Please review the formulas suggested. You stated that you want the first workday for the month.

Excel's help states " WORKDAY.INTL function - Office Support
Returns the serial number of the date before or after a specified number of workdays with custom weekend parameters."

If you want the first workday of a month, enter the last day of the previous month and try the formula or

Enter the first day of the month and subtract 1 or enter any date in the month and subtract day of (Date), this yields the last day of the previous month,
1 specifies next workday, etc.

Workdays.xlsm
AB
14Sat 01-Jan-22Sat 15-Jan-22
15Fri 31-Dec-21Fri 31-Dec-21
16Mon 03-Jan-22Mon 03-Jan-22
1c
Cell Formulas
RangeFormula
A15:B15A15=A14-DAY(A14)
A16:B16A16=WORKDAY.INTL(A15,1,1)
 
Upvote 0

Forum statistics

Threads
1,214,920
Messages
6,122,276
Members
449,075
Latest member
staticfluids

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