looking to return the next Monday + 1 week from a date
Answers
-
I'm having trouble understanding this function.
I am looking to return the next Monday + 1 week from a date.
The above function is working, however, I don't quite understand it which probably means I would not be able to recreate it.
What I think is happening in the above is
if date =Sunday then return (date - (date-5))
so if date is 07/24/22 then return would be 07/19/22?
if date does not equate Sunday then return ((date-5)+11)
so if date is 07/20/22 then return would be 07/26/22?
-
The logic goes this way assuming your date is 7/24/2022:
If the day of the week is Sunday (aka 1) then return Date - (day of the week - 5) which is 7/24/22 - (1-5) = 7/24/22+4 =7/28
and if day is not Sunday then return Date - (day of the week -5) + 7 = 7/24/22 -(1-5) + 7 = 7/24/22 + 4 + 7 = 7/24 + 11 = 8/4/22
In the above case the formula is giving to the next Thursday. If you want Monday then replace 5 with 2 (as Monday is 2nd day in the week)
I also noticed that the formula fails if the date is Monday itself as it does not give next Monday. Here is the one with the fix,
=IF(WEEKDAY(Date@row)=2, Date@row + 7, IF(WEEKDAY(Date@row)=1, Date@row - (WEEKDAY(Date@row)-2), Date@row-(WEEKDAY(Date@row)-2)+7))
Help Article Resources
Categories
- All Categories
- 14 Welcome to the Community
- Customer Resources
- 64.9K Get Help
- 441 Global Discussions
- 139 Industry Talk
- 472 Announcements
- 4.9K Ideas & Feature Requests
- 129 Brandfolder
- 148 Just for fun
- 68 Community Job Board
- 496 Show & Tell
- 33 Member Spotlight
- 2 SmartStories
- 300 Events
- 36 Webinars
- 7.3K Forum Archives
Check out the Formula Handbook template!