Date formula working for half of rows

I have a columns for expiration date, 6 months prior to exp date, and 3 months prior to exp date. Formula for 6 months prior is:

=IFERROR(IFERROR(DATE(YEAR([Expiration Date]@row), MONTH([Expiration Date]@row) - 6, DAY([Expiration Date]@row)), DATE(YEAR([Expiration Date]@row) - 1, MONTH([Expiration Date]@row) + 6, DAY([Expiration Date]@row))), " ")

Formula for 3 months prior is:

=IFERROR(IFERROR(DATE(YEAR([Expiration Date]@row), MONTH([Expiration Date]@row) - 3, DAY([Expiration Date]@row)), DATE(YEAR([Expiration Date]@row) - 1, MONTH([Expiration Date]@row) + 3, DAY([Expiration Date]@row))), " ")

Of the 250 rows in the sheet, 100 times the 3 months prior to exp date calculates incorrectly to 9 months prior, the other dates calculate correctly.

i.e. Exp date = 7/5/27 ; 6 months prior = 1/5/27; 3 months prior = 4/5/27

then I will get Exp Date = 2/3/26; 6 months prior = 8/3/25;3 months prior = 5/3/25 Should be 11/3/25

Tags:

Answers

Help Article Resources

Want to practice working with formulas directly in Smartsheet?

Check out the公式手册模板!
You would take your existing formula and just subtract 1 from it.<\/p>

=existing_formula<\/em> - 1<\/strong><\/p>"}]}},"status":{"statusID":3,"name":"Accepted","state":"closed","recordType":"discussion","recordSubType":"question"},"bookmarked":false,"unread":false,"category":{"categoryID":322,"name":"Formulas and Functions","url":"https:\/\/community.smartsheet.com\/categories\/formulas-and-functions","allowedDiscussionTypes":[]},"reactions":[{"tagID":3,"urlcode":"Promote","name":"Promote","class":"Positive","hasReacted":false,"reactionValue":5,"count":0},{"tagID":5,"urlcode":"Insightful","name":"Insightful","class":"Positive","hasReacted":false,"reactionValue":1,"count":0},{"tagID":11,"urlcode":"Up","name":"Vote Up","class":"Positive","hasReacted":false,"reactionValue":1,"count":0},{"tagID":13,"urlcode":"Awesome","name":"Awesome","class":"Positive","hasReacted":false,"reactionValue":1,"count":0}],"tags":[]},{"discussionID":108403,"type":"question","name":"Date formula to set cut off period","excerpt":"I am trying to set a date formula to for the following statement; if the [Next Due Date] is <= 27\/07\/2023 return \"Performed\" Example: =IF(ISBLANK([Last inspection]@row), \"\", IF(DATE(2023,7,27)) < [Next Due Date]@row, \"Overdue\", \"Performed\"))","snippet":"I am trying to set a date formula to for the following statement; if the [Next Due Date] is <= 27\/07\/2023 return \"Performed\" Example: =IF(ISBLANK([Last inspection]@row), \"\",…","categoryID":322,"dateInserted":"2023-08-02T11:05:55+00:00","dateUpdated":"2023-08-02T11:35:37+00:00","dateLastComment":"2023-08-03T13:16:11+00:00","insertUserID":125711,"insertUser":{"userID":125711,"name":"Adedeji Adebanjo","url":"https:\/\/community.smartsheet.com\/profile\/Adedeji%20Adebanjo","photoUrl":"https:\/\/aws.smartsheet.com\/storageProxy\/image\/images\/u!1!ZrfDGXkxfL4!BfDCQc0uMJQ!nMYqiMpYuek","dateLastActive":"2023-08-03T10:26:54+00:00","banned":0,"punished":0,"private":false,"label":"✭✭✭"},"updateUserID":91566,"lastUserID":45516,"lastUser":{"userID":45516,"name":"Paul Newcome","title":"","url":"https:\/\/community.smartsheet.com\/profile\/Paul%20Newcome","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/userpics\/082\/nQPUTVFKKWDJ2.jpg","dateLastActive":"2023-08-03T13:57:08+00:00","banned":0,"punished":0,"private":false,"label":"✭✭✭✭✭✭"},"pinned":false,"pinLocation":null,"closed":false,"sink":false,"countComments":3,"countViews":24,"score":null,"hot":3382044726,"url":"https:\/\/community.smartsheet.com\/discussion\/108403\/date-formula-to-set-cut-off-period","canonicalUrl":"https:\/\/community.smartsheet.com\/discussion\/108403\/date-formula-to-set-cut-off-period","format":"Rich","lastPost":{"discussionID":108403,"commentID":388688,"name":"Re: Date formula to set cut off period","url":"https:\/\/community.smartsheet.com\/discussion\/comment\/388688#Comment_388688","dateInserted":"2023-08-03T13:16:11+00:00","insertUserID":45516,"insertUser":{"userID":45516,"name":"Paul Newcome","title":"","url":"https:\/\/community.smartsheet.com\/profile\/Paul%20Newcome","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/userpics\/082\/nQPUTVFKKWDJ2.jpg","dateLastActive":"2023-08-03T13:57:08+00:00","banned":0,"punished":0,"private":false,"label":"✭✭✭✭✭✭"}},"breadcrumbs":[{"name":"Home","url":"https:\/\/community.smartsheet.com\/"},{"name":"Get Help","url":"https:\/\/community.smartsheet.com\/categories\/get-help"},{"name":"Formulas and Functions","url":"https:\/\/community.smartsheet.com\/categories\/formulas-and-functions"}],"groupID":null,"statusID":3,"attributes":{"question":{"status":"accepted","dateAccepted":"2023-08-03T08:50:18+00:00","dateAnswered":"2023-08-02T12:58:11+00:00","acceptedAnswers":[{"commentID":388454,"body":"

Try removing one of the closing parenthesis after the DATE function.<\/p>"},{"commentID":388644,"body":"

Thanks! That sorted it!😀<\/span><\/p>"}]}},"status":{"statusID":3,"name":"Accepted","state":"closed","recordType":"discussion","recordSubType":"question"},"bookmarked":false,"unread":false,"category":{"categoryID":322,"name":"Formulas and Functions","url":"https:\/\/community.smartsheet.com\/categories\/formulas-and-functions","allowedDiscussionTypes":[]},"reactions":[{"tagID":3,"urlcode":"Promote","name":"Promote","class":"Positive","hasReacted":false,"reactionValue":5,"count":0},{"tagID":5,"urlcode":"Insightful","name":"Insightful","class":"Positive","hasReacted":false,"reactionValue":1,"count":0},{"tagID":11,"urlcode":"Up","name":"Vote Up","class":"Positive","hasReacted":false,"reactionValue":1,"count":0},{"tagID":13,"urlcode":"Awesome","name":"Awesome","class":"Positive","hasReacted":false,"reactionValue":1,"count":0}],"tags":[]},{"discussionID":108399,"type":"question","name":"Smartsheet Behaviours","excerpt":"I am trying to create a form that throws back a response when you tick a box like the example below. I have been told to use the logic but i cant seem to find a logic that will work, any suggestions? Additionally, if they tick an answer and it is incorrect, I want to show the text in red and if correct the text is in…","snippet":"I am trying to create a form that throws back a response when you tick a box like the example below. I have been told to use the logic but i cant seem to find a logic that will…","categoryID":322,"dateInserted":"2023-08-02T07:07:49+00:00","dateUpdated":"2023-08-02T11:36:01+00:00","dateLastComment":"2023-08-03T13:01:11+00:00","insertUserID":161048,"insertUser":{"userID":161048,"name":"Julieh","url":"https:\/\/community.smartsheet.com\/profile\/Julieh","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/defaultavatar\/nWRMFRX6I99I6.jpg","dateLastActive":"2023-08-02T23:38:32+00:00","banned":0,"punished":0,"private":false,"label":"✭"},"updateUserID":91566,"lastUserID":45516,"lastUser":{"userID":45516,"name":"Paul Newcome","title":"","url":"https:\/\/community.smartsheet.com\/profile\/Paul%20Newcome","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/userpics\/082\/nQPUTVFKKWDJ2.jpg","dateLastActive":"2023-08-03T13:57:08+00:00","banned":0,"punished":0,"private":false,"label":"✭✭✭✭✭✭"},"pinned":false,"pinLocation":null,"closed":false,"sink":false,"countComments":3,"countViews":29,"score":null,"hot":3382029540,"url":"https:\/\/community.smartsheet.com\/discussion\/108399\/smartsheet-behaviours","canonicalUrl":"https:\/\/community.smartsheet.com\/discussion\/108399\/smartsheet-behaviours","format":"Rich","lastPost":{"discussionID":108399,"commentID":388680,"name":"Re: Smartsheet Behaviours","url":"https:\/\/community.smartsheet.com\/discussion\/comment\/388680#Comment_388680","dateInserted":"2023-08-03T13:01:11+00:00","insertUserID":45516,"insertUser":{"userID":45516,"name":"Paul Newcome","title":"","url":"https:\/\/community.smartsheet.com\/profile\/Paul%20Newcome","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/userpics\/082\/nQPUTVFKKWDJ2.jpg","dateLastActive":"2023-08-03T13:57:08+00:00","banned":0,"punished":0,"private":false,"label":"✭✭✭✭✭✭"}},"breadcrumbs":[{"name":"Home","url":"https:\/\/community.smartsheet.com\/"},{"name":"Get Help","url":"https:\/\/community.smartsheet.com\/categories\/get-help"},{"name":"Formulas and Functions","url":"https:\/\/community.smartsheet.com\/categories\/formulas-and-functions"}],"groupID":null,"statusID":3,"image":{"url":"https:\/\/us.v-cdn.net\/6031209\/uploads\/TZJ2NJ1GP5G8\/image.png","urlSrcSet":{"10":"","300":"","800":"","1200":"","1600":""},"alt":"image.png"},"attributes":{"question":{"status":"accepted","dateAccepted":"2023-08-03T09:08:52+00:00","dateAnswered":"2023-08-02T12:54:16+00:00","acceptedAnswers":[{"commentID":388451,"body":"

You would have to insert a new header field into the form that has that particular verbiage formatted the way you want then use the form field logic to display this header row if one of the incorrect answers is selected.<\/p>"}]}},"status":{"statusID":3,"name":"Accepted","state":"closed","recordType":"discussion","recordSubType":"question"},"bookmarked":false,"unread":false,"category":{"categoryID":322,"name":"Formulas and Functions","url":"https:\/\/community.smartsheet.com\/categories\/formulas-and-functions","allowedDiscussionTypes":[]},"reactions":[{"tagID":3,"urlcode":"Promote","name":"Promote","class":"Positive","hasReacted":false,"reactionValue":5,"count":0},{"tagID":5,"urlcode":"Insightful","name":"Insightful","class":"Positive","hasReacted":false,"reactionValue":1,"count":0},{"tagID":11,"urlcode":"Up","name":"Vote Up","class":"Positive","hasReacted":false,"reactionValue":1,"count":0},{"tagID":13,"urlcode":"Awesome","name":"Awesome","class":"Positive","hasReacted":false,"reactionValue":1,"count":0}],"tags":[]}],"initialPaging":{"nextURL":"https:\/\/community.smartsheet.com\/api\/v2\/discussions?page=2&categoryID=322&includeChildCategories=1&type%5B0%5D=Question&excludeHiddenCategories=1&sort=-hot&limit=3&expand%5B0%5D=all&expand%5B1%5D=-body&expand%5B2%5D=insertUser&expand%5B3%5D=lastUser&status=accepted","prevURL":null,"currentPage":1,"total":10000,"limit":3},"title":"Trending in Formulas and Functions ","subtitle":null,"description":null,"noCheckboxes":true,"containerOptions":[],"discussionOptions":[]}">

Trending in Formulas and Functions