Forum Discussion
Boughton1999
Aug 02, 2023Copper Contributor
Trying to find nearest specific date from another date
I'm trying to create a formula where by I can find the nearest monday OR wednesday to a specific date i.e. 12/8/23 - any help?
- Aug 07, 2023
With a date in A2:
=A2+IF(WEEKDAY(A2,13)<=3,1,6)-WEEKDAY(A2,13)
or
=LET(d, WEEKDAY(A2,13), A2+IF(d<=3,1,6)-d)
Boughton1999
Aug 07, 2023Copper Contributor
Hi Sergei, so if today was Tuesday, I'd want it to round to the Monday. Similarly, if it was Thursday/Friday, I'd want it to be Wednesday. Hope this makes sense?
HansVogelaar
Aug 07, 2023MVP
With a date in A2:
=A2+IF(WEEKDAY(A2,13)<=3,1,6)-WEEKDAY(A2,13)
or
=LET(d, WEEKDAY(A2,13), A2+IF(d<=3,1,6)-d)
- Boughton1999Aug 07, 2023Copper ContributorHi Hans,
This has worked perfectly. Thanks ever so much!