Get Due Date by counting calendar days but result should exclude weekends and holidays

jneria

New Member
Joined
May 11, 2023
Messages
7
Office Version
  1. 365
  2. 2021
  3. 2019
  4. 2016
Platform
  1. Windows
  2. MacOS
  3. Mobile
  4. Web
Hi all,

I am going crazy trying to figure this out. The formula I am using work for some dates but not others, please help me figure out what is wrong.

FIRST FORMULA:

=WORKDAY.INTL(D10, 21, "0000000", StatHolidays!A1:A24)+IF(WEEKDAY(WORKDAY.INTL(D10, 21, "0000000", StatHolidays!A1:A24),2)>5,2,0)+IF(COUNTIF(StatHolidays!A1:A24,WORKDAY.INTL(D10, 21, "0000000", StatHolidays!A1:A24))=1,1,0)

D10 = 2023-12-04
Result = 2023-12-27 (This is correct)

=WORKDAY.INTL(D26, 35, "0000000", StatHolidays!A1:A24)+IF(WEEKDAY(WORKDAY.INTL(D26, 35, "0000000", StatHolidays!A1:A24),2)>5,2,0)+IF(COUNTIF(StatHolidays!A1:A24,WORKDAY.INTL(D26, 35, "0000000", StatHolidays!A1:A24))=1,1,0)

D26 - 2023-05-16
Result = 2023-06-21 (This is incorrect, it should be 2023-06-20)

As you can see, I feel like I am using the exact same formulas, just editing the argument based on what I need. Please help and thank you.
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
your weekend reference for Sat & Sun weekends should just be a 1 or "1000001".

but if you can use the xl2bb add in a post a mini workbook it would be helful if what I have above is not working for you. Link is below.
 
Upvote 0
your weekend reference for Sat & Sun weekends should just be a 1 or "1000001".

but if you can use the xl2bb add in a post a mini workbook it would be helful if what I have above is not working for you. Link is below.

Hello and thank you so much for your time, here it is.

Book1
ABCD
3start datewhat it needs to dowhat the result should bewhat the result is using formula
42023-12-04add 21 calendar days but if the result is a weekend or holiday, should result to the next business day instead2023-12-272023-12-27
52023-05-16add 35 calendar days but if the result is a weekend or holiday, should result to the next business day instead2023-06-202023-06-21
Sheet1
Cell Formulas
RangeFormula
D4D4=WORKDAY.INTL(A4, 21, "0000000", StatHolidays!A1:A24)+IF(WEEKDAY(WORKDAY.INTL(A4, 21, "0000000", StatHolidays!A1:A24),2)>5,2,0)+IF(COUNTIF(StatHolidays!A1:A24,WORKDAY.INTL(A4, 21, "0000000", StatHolidays!A1:A24))=1,1,0)
D5D5=WORKDAY.INTL(A5, 35, "0000000", StatHolidays!A1:A24)+IF(WEEKDAY(WORKDAY.INTL(A5, 35, "0000000", StatHolidays!A1:A24),2)>5,2,0)+IF(COUNTIF(StatHolidays!A1:A24,WORKDAY.INTL(A5, 35, "0000000", StatHolidays!A1:A24))=1,1,0)
 
Upvote 0
your weekend reference for Sat & Sun weekends should just be a 1 or "1000001".

but if you can use the xl2bb add in a post a mini workbook it would be helful if what I have above is not working for you. Link is below.

by the way, here are the holidays listed in my StatHolidays sheet

2023-04-10​
2023-05-22​
2023-07-03​
2023-08-07​
2023-09-04​
2023-10-09​
2023-11-13​
2023-12-25​
2023-12-26​
2024-01-01​
2024-02-12​
2024-03-29​
2024-04-01​
2024-05-20​
2024-07-01​
2024-08-05​
2024-09-02​
2024-10-14​
2024-11-11​
2024-12-25​
2024-12-26​
 
Upvote 0
you also need to post the worksheet StatHolidays
 
Upvote 0
you also need to post the worksheet StatHolidays

Here it is:

Book1
A
12023-04-10
22023-05-22
32023-07-03
42023-08-07
52023-09-04
62023-10-09
72023-11-13
82023-12-25
92023-12-26
102024-01-01
112024-02-12
122024-03-29
132024-04-01
142024-05-20
152024-07-01
162024-08-05
172024-09-02
182024-10-14
192024-11-11
202024-12-25
212024-12-26
StatHolidays
Cells with Conditional Formatting
CellConditionCell FormatStop If True
A1:A21Cell ValueduplicatestextNO
 
Upvote 0
try this:
i move the holidays to my worksheet.

Mr excel questions 35.xlsm
ABCDEFG
1start datewhat it needs to dowhat the result should be2023-04-10
22023-12-04add 21 calendar days but if the result is a weekend or holiday, should result to the next business day instead2023-12-272023-12-272023-05-22
32023-05-16add 35 calendar days but if the result is a weekend or holiday, should result to the next business day instead2023-06-202023-06-202023-07-03
42023-08-07
52023-09-04
62023-10-09
72023-11-13
82023-12-25
92023-12-26
102024-01-01
112024-02-12
122024-03-29
132024-04-01
142024-05-20
152024-07-01
162024-08-05
172024-09-02
182024-10-14
192024-11-11
202024-12-25
212024-12-26
jneria
Cell Formulas
RangeFormula
C2C2=IF( OR( ISNUMBER(MATCH(A2+21,$G$1:$G$21,0)), WEEKDAY(A2+21,2)>5), WORKDAY.INTL(A2+21,1,1,$G$1:$G$21), A2+21)
C3C3=IF( OR( ISNUMBER(MATCH(A3+35,$G$1:$G$21,0)), WEEKDAY(A3+35,2)>5), WORKDAY.INTL(A3+21,1,1,$G$1:$G$21), A3+35)
 
Upvote 0
try this:
i move the holidays to my worksheet.

Mr excel questions 35.xlsm
ABCDEFG
1start datewhat it needs to dowhat the result should be2023-04-10
22023-12-04add 21 calendar days but if the result is a weekend or holiday, should result to the next business day instead2023-12-272023-12-272023-05-22
32023-05-16add 35 calendar days but if the result is a weekend or holiday, should result to the next business day instead2023-06-202023-06-202023-07-03
42023-08-07
52023-09-04
62023-10-09
72023-11-13
82023-12-25
92023-12-26
102024-01-01
112024-02-12
122024-03-29
132024-04-01
142024-05-20
152024-07-01
162024-08-05
172024-09-02
182024-10-14
192024-11-11
202024-12-25
212024-12-26
jneria
Cell Formulas
RangeFormula
C2C2=IF( OR( ISNUMBER(MATCH(A2+21,$G$1:$G$21,0)), WEEKDAY(A2+21,2)>5), WORKDAY.INTL(A2+21,1,1,$G$1:$G$21), A2+21)
C3C3=IF( OR( ISNUMBER(MATCH(A3+35,$G$1:$G$21,0)), WEEKDAY(A3+35,2)>5), WORKDAY.INTL(A3+21,1,1,$G$1:$G$21), A3+35)

this just works perfectly! thank you so much. could I ask why the formula in bold had to have a +21 instead of a +42?

=IF(OR(ISNUMBER(MATCH(D10+42,StatHolidays!A1:A24,0)),WEEKDAY(D10+42,2)>5),WORKDAY.INTL(D10+21,1,1,StatHolidays!A1:A24),D10+42)

thank you again!
 
Upvote 0
this just works perfectly! thank you so much. could I ask why the formula in bold had to have a +21 instead of a +42?

=IF(OR(ISNUMBER(MATCH(D10+42,StatHolidays!A1:A24,0)),WEEKDAY(D10+42,2)>5),WORKDAY.INTL(D10+21,1,1,StatHolidays!A1:A24),D10+42)

thank you again!
Your requirement was for 21 days not 42. So, I'm not really sure how 42 is being considered? Could you explain, did I miss something?
 
Upvote 0
Your requirement was for 21 days not 42. So, I'm not really sure how 42 is being considered? Could you explain, did I miss something?

Sorry, I was referring to the formula you had for C3, I was trying it out for different number of days just to see how it worked, you still used +21 below but everything else says +35 but it worked perfectly.

=IF( OR( ISNUMBER(MATCH(A3+35,$G$1:$G$21,0)), WEEKDAY(A3+35,2)>5), WORKDAY.INTL(A3+21,1,1,$G$1:$G$21), A3+35)
 
Upvote 0

Forum statistics

Threads
1,215,147
Messages
6,123,297
Members
449,095
Latest member
Chestertim

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