If function to exclude weekends and Holidays

Bazabelle

New Member
Joined
Oct 6, 2022
Messages
34
Office Version
  1. 365
Platform
  1. Windows
Hi,

Not sure how to use this formula from another post; =IF(AND(WORKDAY(C3,0)=WORKDAY(TODAY(),0),E3<>""),E3,"")

Currently I have this one which works perfectly but I want to exclude any Holidays

=IF(WEEKDAY(E4+D6, 2)= 7,E4+D6+1,IF(WEEKDAY(E4+D6,2)= 6,E4+D6+2, E4+D6))

E4 = 16Aug2023
D6 = 6
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
what are you trying to accomplish? Are you trying to find the next non weekend/non holiday day's date after a specific number of days?

This excludes all Saturdays, Sundays, and Holidays in a holiday list:

Mr Excel Questions 73.xlsm
ABCDE
1
2
3
4Friday, August 25, 2023Wednesday, August 16, 2023
5
6Holiday List6
7Friday, August 18, 2023
8
Bazabelle
Cell Formulas
RangeFormula
A4A4=WORKDAY.INTL(E4,D6,1,A7)
 
Upvote 0
what are you trying to accomplish? Are you trying to find the next non weekend/non holiday day's date after a specific number of days?

This excludes all Saturdays, Sundays, and Holidays in a holiday list:

Mr Excel Questions 73.xlsm
ABCDE
1
2
3
4Friday, August 25, 2023Wednesday, August 16, 2023
5
6Holiday List6
7Friday, August 18, 2023
8
Bazabelle
Cell Formulas
RangeFormula
A4A4=WORKDAY.INTL(E4,D6,1,A7)
Ok, this works, considering that the number of days would be 6 working days where in my formulas it counts 6 days but return to the working day before/after. Thanks! :)
 
Upvote 0
So, what did you want? Can you give me all the criteria and the expectation:
Date: ??
Days to Count: ??
Holidays: ??
What are your weekend days (days not worked)?: ??
 
Upvote 0
So, what did you want? Can you give me all the criteria and the expectation:
Date: ??
Days to Count: ??
Holidays: ??
What are your weekend days (days not worked)?: ??
Date: 20Dec2023
Days to Count: 6
Holidays: 25Dec2023 to 01Jan2024
What are your weekend days (days not worked)?: Saturday, Sunday

answer would technically be: 26Dec2023 but considering the Holidays it would need to return 02Jan2024
 
Upvote 0
I would think it would return Jan. 3, 2024.

Book2
ABCDEFGH
112/25/202361/3/2024Holidays
212/25/2023
31/1/2024
Sheet1
Cell Formulas
RangeFormula
C1C1=WORKDAY(A1,B1,H2:H3)
 
Upvote 0
I'll go with the 5th if the OP wants 6 working days from the 20th
Holidays: 25Dec2023 to 01Jan2024


Book1
ABCDEFGH
120/12/2023605/01/2024Holidays
225/12/2023
326/12/2023
427/12/2023
528/12/2023
629/12/2023
730/12/2023
831/12/2023
901/01/2024
Sheet1
Cell Formulas
RangeFormula
C1C1=WORKDAY(A1,B1,H2:H9)


or if the OP wants the 2nd (although adding 6 calendar days seems a bit random to me)

Book1
ABCDEFGH
120/12/2023102/01/2024Holidays
225/12/2023
326/12/2023
427/12/2023
528/12/2023
629/12/2023
730/12/2023
831/12/2023
901/01/2024
Sheet1
Cell Formulas
RangeFormula
C1C1=WORKDAY(A1+6,B1,H2:H9)
 
Last edited:
Upvote 0
Ok, so with feedback I got above (thank you all) I am almost with the formula I need... so the team wants to have calendar days to be counting, returning on a working day , and exclude the holidays... this formula is bringing me 1 day short, it should return 30Nov2023:

  • Start Date: 24Nov2023
  • Number calendar days: 6
  • Date to return: 30Nov2023

=IF(WEEKDAY(WORKDAY.INTL(E4,D6,17,HOLIDAYS!A:A)-1)=7,WORKDAY.INTL(E4,D6,17,HOLIDAYS!A:A)+1,IF(WEEKDAY(WORKDAY.INTL(E4,D6,17,HOLIDAYS!A:A)-1)=6,WORKDAY.INTL(E4,D6,17,HOLIDAYS!A:A)+2,WORKDAY.INTL(E4,D6,17,HOLIDAYS!A:A)))

The portion to exclude Holidays (which is another part of calculation I need) seems to work with this formula. So just need to fix the including weekends and returning on a working day.
 
Upvote 0
Workday adds the 2nd criteria in days so try to use 5 in my last formula so it reality it is 5 + 1

Book1
ABCDEFGH
120/12/2023102/01/2024Holidays
224/11/202330/11/202325/12/2023
326/12/2023
427/12/2023
528/12/2023
629/12/2023
730/12/2023
831/12/2023
901/01/2024
Sheet1
Cell Formulas
RangeFormula
C1:C2C1=WORKDAY(A1+5,$B$1,$H$2:$H$9)
 
Upvote 0
Workday adds the 2nd criteria in days so try to use 5 in my last formula so it reality it is 5 + 1

Book1
ABCDEFGH
120/12/2023102/01/2024Holidays
224/11/202330/11/202325/12/2023
326/12/2023
427/12/2023
528/12/2023
629/12/2023
730/12/2023
831/12/2023
901/01/2024
Sheet1
Cell Formulas
RangeFormula
C1:C2C1=WORKDAY(A1+5,$B$1,$H$2:$H$9)
when I use this it breaks because my cell has "6" instead of "1" and I cannot change this, I need to leave it to show it is 6 calendar days.
 

Attachments

  • Capture.PNG
    Capture.PNG
    5.2 KB · Views: 4
Upvote 0

Forum statistics

Threads
1,215,214
Messages
6,123,661
Members
449,114
Latest member
aides

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