Formula to calculate 30 days before
Hi, I have a column with a Partner Due Date (manually entered), and a column with an Internal Due Date (column formula). I would like for the Internal Due Date to be 30 days before the Partner Due Date and am using this formula:
=DATE(YEAR([Partner Due Date]@row), MONTH([Partner Due Date]@row) - 1, DAY([Partner Due Date]@row))
For any Partner Due Dates that are January, I am getting an #INVALID VALUE error. Any suggestions for how to fix this formula so that January Internal Due Dates are December? Thank you!
Best Answer
-
@alys If you literally want the internal due date to be 30 days prior to the partner due date, then you can just use:
=[Partner Due Date]@row - 30
However, it looks like what you really want is the same day of the month, but one month prior. If so, try this:
=IFERROR(IF(MONTH([Partner Due Date]@row) > 1, DATE(YEAR([Partner Due Date]@row), MONTH([Partner Due Date]@row) - 1, DAY([Partner Due Date]@row)), IF(MONTH([Partner Due Date]@row) = 1, DATE(YEAR([Partner Due Date]@row) - 1, MONTH([Partner Due Date]@row) + 11, DAY([Partner Due Date]@row)))), "")
The IFERROR is there just in case there are any blank partner due dates.
Answers
-
@alys If you literally want the internal due date to be 30 days prior to the partner due date, then you can just use:
=[Partner Due Date]@row - 30
However, it looks like what you really want is the same day of the month, but one month prior. If so, try this:
=IFERROR(IF(MONTH([Partner Due Date]@row) > 1, DATE(YEAR([Partner Due Date]@row), MONTH([Partner Due Date]@row) - 1, DAY([Partner Due Date]@row)), IF(MONTH([Partner Due Date]@row) = 1, DATE(YEAR([Partner Due Date]@row) - 1, MONTH([Partner Due Date]@row) + 11, DAY([Partner Due Date]@row)))), "")
The IFERROR is there just in case there are any blank partner due dates.
-
@Kelly P. thank you!
-
@alys Happy to help! 😊
Help Article Resources
Categories
- All Categories
- 14 Welcome to the Community
- Smartsheet Customer Resources
- 64.2K Get Help
- 419 Global Discussions
- 221 Industry Talk
- 461 Announcements
- 4.8K Ideas & Feature Requests
- 143 Brandfolder
- 142 Just for fun
- 58 Community Job Board
- 462 Show & Tell
- 32 Member Spotlight
- 1 SmartStories
- 300 Events
- 39 Webinars
- 7.3K Forum Archives
Check out the Formula Handbook template!