Excel Date Formula

jesshope2023

New Member
Joined
Jun 13, 2023
Messages
1
Office Version
  1. 365
Platform
  1. Windows
Hi!

I am trying (with difficulties, apparently) to create the below described formula for my work. I am somewhat of a novice with excel, and would truly appreciate the help!!!

I need this formula to return the date that is at least 2 weeks from today that falls on either the first, third, or fifth Tuesday of the month (whichever is closest after the two weeks) AND that will exclude federal holidays.

Thank you in advance!!
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
A few examples would be very useful.
T202306a.xlsm
ABCD
1Days Future14Unique List
21-Jun-23Tue 20-Jun-23Tue 06-Jun-23
320-Jun-23Tue 04-Jul-23Tue 20-Jun-23
45-Jul-23Tue 01-Aug-23Tue 04-Jul-23
51-Aug-23Tue 15-Aug-23Tue 18-Jul-23
6Tue 01-Aug-23
7Tue 15-Aug-23
8Tue 29-Aug-23
9Tue 05-Sep-23
10Tue 19-Sep-23
11
3c
Cell Formulas
RangeFormula
B2:B3B2=XLOOKUP(WORKDAY.INTL(A2+$B$1-1,1,"1011111",Holidays),$D$2:$D$10,$D$2:$D$10,,1)
B4B4=XLOOKUP(WORKDAY.INTL(A4+14,1,"1011111",Holidays),$D$2:$D$10,$D$2:$D$10,,1)
B5B5=XLOOKUP(WORKDAY.INTL(A5+13,1,"1011111",Holidays),$D$2:$D$10,$D$2:$D$10,,1)
Named Ranges
NameRefers ToCells
Holidays='3c'!$M$1B2:B5
 
Upvote 0
T202306a.xlsm
AB
91-Jun-2320-Jun-23
1020-Jun-234-Jul-23
115-Jul-231-Aug-23
121-Aug-235-Sep-23
13
3c
Cell Formulas
RangeFormula
B9:B12B9=LET(dt,WORKDAY.INTL(F2-1,{1,3,5},"1011111",Holidays),XLOOKUP(WORKDAY.INTL(A2+$B$1-1,1,"1011111",Holidays),dt,dt,,1))
Named Ranges
NameRefers ToCells
Holidays='3c'!$M$1B9:B12
 
Upvote 0
UDF solution is here.
Code for UDF "GetTuesday"
VBA Code:
Function GetTuesday(Ip As Long)
Dim Dt&, T&, temp
Dim M
Dt = Ip + 15
M = Evaluate("=" & Dt & "-WEEKDAY(" & Dt & ",12)+{1,8,15,22,29,36,43,50}")
For T = 1 To 5
If Day(M(T)) < 9 Or (Day(M(T)) > 14 And Day(M(T)) < 22) Or Day(M(T)) > 28 Then 'and day(M(T))<22)
temp = M(T): Exit For
End If
Next T
ActiveCell.NumberFormat = "d/m/yy"
GetTuesday = temp
End Function
How to Use UDF code:
In the developer tab click--> Visual Basic
VB window opens
Insert--> Module
Paste the code.
Close the VB window.
Now UDF is available in Function List
Save file as .xlsm

DATERESULT
01-05-2023​
16-05-2023​
02-05-2023​
16-05-2023​
08-05-2023​
30-05-2023​
14-05-2023​
30-05-2023​
20-05-2023​
30-05-2023​
26-05-2023​
06-06-2023​
01-06-2023​
20-06-2023​
07-06-2023​
20-06-2023​
13-06-2023​
04-07-2023​
19-06-2023​
04-07-2023​
25-06-2023​
04-07-2023​
01-07-2023​
18-07-2023​
07-07-2023​
18-07-2023​
13-07-2023​
01-08-2023​
19-07-2023​
01-08-2023​
25-07-2023​
08-08-2023​
 
Upvote 0
What date do you want to show if the date calculated is on a Federal Holiday?
My post #3 was not the correct post; please ignore it.
 
Upvote 0

Forum statistics

Threads
1,215,375
Messages
6,124,591
Members
449,174
Latest member
chandan4057

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