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.
 
I'm looking at your question here again:

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!

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)


OK, then I have an error there, my bad.

it should be:

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

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
this is the correct mini workbook:
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+35,1,1,$G$1:$G$21), A3+35)
 
Upvote 0
Solution
I'm looking at your question here again:






OK, then I have an error there, my bad.

it should be:

Excel Formula:
=IF( OR( ISNUMBER(MATCH(A3+35,$G$1:$G$21,0)), WEEKDAY(A3+35,2)>5), WORKDAY.INTL(A3+35,1,1,$G$1:$G$21), A3+35)
It was working, no matter how the number of days I tried, thank you again!
 
Upvote 0
It was working, no matter how the number of days I tried, thank you again!
My pleasure. I'm pleased you were able to find a solution here on the Mr. Excel Forum.
And if you think a post in the thread has answered your question, please mark it as the answer.

Best wishes!
 
Upvote 0

Forum statistics

Threads
1,215,148
Messages
6,123,307
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