adding three months to a date (but factor in weekends and holidays)

daveyc18

Well-known Member
Joined
Feb 11, 2013
Messages
755
Office Version
  1. 365
  2. 2010
so i have a cell that's referencing h4 and has the date 8/16/2023...the rule is if the date is less than the current date (in this case 8/17/2023), add 3 months

so when i use edate(h4,3), it gives me 11/11/23, but it should be 11/13/23, because 11/11/23 falls on a weekend

i would also like thte formula to take into acocunt holidays (of course via a holidays table) if possible
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
First of all Edate(h4,3) gives me 16/11/2023 if there is 16/8/2023 in H4 not 11/11/2023 (my number format is dd/mm/yyyy) so in the below I have 11/8/2023 in H4.
Holidays is a named range containing your holiday dates

Book1 (version 2).xlsb
HI
411/08/2023Monday 13/11/2023
Sheet4
Cell Formulas
RangeFormula
I4I4=IF(H4<>TODAY(),IF(WEEKDAY(EDATE(H4,3),2)>5,WORKDAY(EDATE(H4,3),1,Holidays),EDATE(H4,3)),"today")
Named Ranges
NameRefers ToCells
Holidays=Sheet4!$K$1:$K$7I4
 
Last edited:
Upvote 0
Here is another way of taking into account weekends and holidays:
Excel Formula:
=WORKDAY(EDATE(H4,3)-1,1,Holidays)
 
Upvote 0
Not heavily tested but you might just be able to use the formula in I5 (same as previous post Holidays is a named range containing your holiday dates

Book1 (version 2).xlsb
HI
411/08/2023Monday 13/11/2023
5Monday 13/11/2023
Sheet4
Cell Formulas
RangeFormula
I4I4=IF(H4<>TODAY(),IF(WEEKDAY(EDATE(H4,3),2)>5,WORKDAY(EDATE(H4-1,3),1,Holidays),WORKDAY(EDATE(H4-1,3),1,Holidays)),"today")
I5I5=IF(H4<>TODAY(),WORKDAY(EDATE(H4-1,3),1,Holidays),"today")
Named Ranges
NameRefers ToCells
Holidays=Sheet4!$K$1:$K$7I4:I5


EDIT: looks like @Tetra201 had the same idea
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,289
Members
452,631
Latest member
a_potato

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