Formula to add days to a date
I have a dropdown column for PM Frequency (1 month, 3 month, 6 month etc...) and date columns for last PM and next PM. I want to add the appropriate number of days to last PM to generate a date for next PM based on the PM frequency. What is the best way to write a formula for this?
Best Answer
-
Let me know if this needs adjusted any.
=IF([PM Frequency]@row = "1 Month", [Last PM]@row + 30, IF([PM Frequency]@row = "3 month", [Last PM]@row + 90, IF([PM Frequency]@row = "6 month", [Last PM]@row + 180, IF([PM Frequency]@row = "9 month", [Last PM]@row + 270, IF([PM Frequency]@row = "12 month", [Last PM]@row + 365)))))
Answers
-
Let me know if this needs adjusted any.
=IF([PM Frequency]@row = "1 Month", [Last PM]@row + 30, IF([PM Frequency]@row = "3 month", [Last PM]@row + 90, IF([PM Frequency]@row = "6 month", [Last PM]@row + 180, IF([PM Frequency]@row = "9 month", [Last PM]@row + 270, IF([PM Frequency]@row = "12 month", [Last PM]@row + 365)))))
-
I see this has already been answered. But here is a solution that will allow any number of months to be added to the drop down. As long as it is in the format "# Months" Example: 23 Months
=IFERROR(DATE(YEAR([last PM]@row) + INT((MONTH([last PM]@row) + INT(VALUE(LEFT([PM Frequency]@row, FIND(" ", [PM Frequency]@row) - 1)))) / 12.01), ROUND(MOD(MONTH([last PM]@row) + INT(VALUE(LEFT([PM Frequency]@row, FIND(" ", [PM Frequency]@row) - 1))), 12.01), 0), 1) + DAY([last PM]@row - 1), "")
-
Magic!
Thank you both for the help!
Help Article Resources
Categories
Check out the Formula Handbook template!