Date format Formula
Hi All
My Date column is formatted to YY/MM/DD - 2024-11-08
I have a week-ending column with the following formula. Returning the End day of the week that the Date column falls into
=IF(OR(ISBLANK([Date]@row), [Date]@row = "N/A"), "", "WE- " + ([Date]@row + (6 - WEEKDAY([Date]@row))))
BUT the return looks like this WE- 08-11-2024
How can I get it to return WE - 2024-11-08
Best Answer
-
Give this a try:
=IF(OR(ISBLANK([Date]@row), [Date]@row = "N/A"), "", "WE - " + YEAR([Date]@row + (6 - WEEKDAY([Date]@row))) + "-" + IF(MONTH([Date]@row + (6 - WEEKDAY([Date]@row))) < 10, "0") + MONTH([Date]@row + (6 - WEEKDAY([Date]@row))) + "-" + IF(DAY([Date]@row + (6 - WEEKDAY([Date]@row))) < 10, "0") + DAY([Date]@row + (6 - WEEKDAY([Date]@row))))
This will essentially systematically assemble the desired date format. There are provisions for days and months that are single digit. Otherwise you would end up with results such as WE - 2025-1-4 instead of WE - 2025-01-04.
Answers
-
Give this a try:
=IF(OR(ISBLANK([Date]@row), [Date]@row = "N/A"), "", "WE - " + YEAR([Date]@row + (6 - WEEKDAY([Date]@row))) + "-" + IF(MONTH([Date]@row + (6 - WEEKDAY([Date]@row))) < 10, "0") + MONTH([Date]@row + (6 - WEEKDAY([Date]@row))) + "-" + IF(DAY([Date]@row + (6 - WEEKDAY([Date]@row))) < 10, "0") + DAY([Date]@row + (6 - WEEKDAY([Date]@row))))
This will essentially systematically assemble the desired date format. There are provisions for days and months that are single digit. Otherwise you would end up with results such as WE - 2025-1-4 instead of WE - 2025-01-04.
-
Thank you Carson - Worked a treat :-)
Help Article Resources
Categories
- All Categories
- 14 Welcome to the Community
- Customer Resources
- 64.9K Get Help
- 441 Global Discussions
- 139 Industry Talk
- 471 Announcements
- 4.9K Ideas & Feature Requests
- 129 Brandfolder
- 148 Just for fun
- 68 Community Job Board
- 495 Show & Tell
- 33 Member Spotlight
- 2 SmartStories
- 300 Events
- 36 Webinars
- 7.3K Forum Archives
Check out the Formula Handbook template!