Date 6 months out (to the day)

cpo1
cpo1 ✭✭
edited 12/09/19 inFormulas and Functions

Hello colleagues and guests. I would like to learn a forumula to retrieve a date that is exactly six months later than a known date; i.e. Jan 1 - July 1, Feb 4 - Aug 4. Presently, I'm using 182 days, which is close, but not exact. I'm also new at SS, so I am just now learning syntex, etc., regarding functions and formulas. Help is appreciated.

Comments

  • Paul Newcome
    Paul Newcome ✭✭✭✭✭✭

    Yes. It is very possible. The most basic way of doing it is using the DATE function in combination with the YEAR, MONTH, and DAY functions and adding 6 to the month number.

    =DATE(YEAR([Known Date Column]@row),MONTH([Known Date Column]@row)+ 6, DAY([Known Date Column]@row))

    .

    However... This will only work for January through June. Any number greater than 12 in the month portion of the DATE function will throw an error.

    The formula for months that will extend beyond 12 add 1 to the year and then subtract 6 from the months.

    =DATE(YEAR([Known Date Column]@row)+ 1,MONTH([Known Date Column]@row)- 6, DAY([Known Date Column]@row))

    .

    There are two ways to combine these. One would be to use an IF statement, and the other would be to use an IFERROR statement. They both would work almost identically in context with only slight differences in syntax.

    .

    For the IF statement, we will say that: if the month of the known date is less than or equal to 6,run the first formula,else run the second formula.

    =IF(MONTH([Known Date Column]@row)<=6,DATE(YEAR([Known Date Column]@row), MONTH([Known Date Column]@row)+ 6, DAY([Known Date Column]@row)),DATE(YEAR([Known Date Column]@row)+ 1, MONTH([Known Date Column]@row)- 6, DAY([Known Date Column]@row)))

    .

    The IFERROR is very similar. Basically it says: dothis, but if there is an error then dothat.

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

  • Paul Newcome
    Paul Newcome ✭✭✭✭✭✭
    edited 06/05/19

    Also... To help with building formulas and learning the syntax, there are quite a few resources you can use. Obviously you have found the Community. I personally have learned A LOT from here.

    There is also a template in the Solutions Center named "Smartsheet Formula Examples" (see attachment for screenshot of what it looks like in the Solution Center). You can download this template that contains all of the different functions along with their syntax and interactive examples of their use. If you happen to accidentally mess something up in the sheet, you can just delete it and re-download the template.

    Another that is extremely helpful is this web pageHERE. It is a listing of all of the different error messages you can receive, what they mean, causes, and some basic troubleshooting.

    Formula Examples.PNG

  • cpo1
    cpo1 ✭✭

    Thanks for the help Paul. I appreciate it. I had gotten to the part where the year didn't like a change, so your explanation is a great help. I'll work through it soon. I had found and opened "Smartsheet Forumula Examples" which are a big help and I used the year,month,day (date function). It worked fine until a change of year was needed as you are quite aware. Also, thanks for the help references. I'll be perusing those soon as well.

  • Paul Newcome
    Paul Newcome ✭✭✭✭✭✭

    Happy to help!yes

    Let me know how it works out for you. If it doesn't I'd be happy to continue working on this with you.

  • 你好,我想加5个月执行Summary for period EOM column. The formula I am using works for several months, but I get an error for the other months. Here is the formula that I am using:

    =IFERROR(DATE(YEAR([Executive Summary for Period EOM]@row), MONTH([Executive Summary for Period EOM]@row) + 5, DAY([Executive Summary for Period EOM]@row)), DATE(YEAR([Executive Summary for Period EOM]@row) + 1, MONTH([Executive Summary for Period EOM]@row) - 5, DAY()))

    image.png


  • Kelly Moore
    Kelly Moore ✭✭✭✭✭✭

    Hi Daniel

    It looks like the last Day term in your equation is the problem. It doesn't point to a cell. Try adding your column name@row, [Executive Summary for Period EOM]@row, to the Day parentheses.

    Kelly

  • Kelly,

    Thanks very much! That was the fix:)

  • EimearC
    EimearC ✭✭

    @Paul NewcomeHi Paul, I hope you don't mind me asking you a question on an old thread? I am using the below formula that you posted which is great for adding 10 months to a date but I can't seem to get the IFERROR part working. Can you please take a look to see where I'm going wrong?

    "=IFERROR(DATE(YEAR([Received Price List Date]@row), MONTH([Received Price List Date]@row) + 10, DAY([Received Price List Date]@row)), DATE(YEAR([Received Price List Date]@row) + 1, MONTH([Received Price List Date]@row) - 2, DAY([Received Price List Date]@row)))" is the formula working fine but getting an "Invalid Data Type" error when there is no data in Received Price List Date. I was hoping to change the formula to the below to account for this:

    "=IFERROR(DATE(YEAR([Received Price List Date]@row), MONTH([Received Price List Date]@row) + 10, DAY([Received Price List Date]@row)), DATE(YEAR([Received Price List Date]@row) + 1, MONTH([Received Price List Date]@row) - 2, DAY([Received Price List Date]@row)), "")"

    but now I receive an error for "Incorrect Argument Set". Can you advise where I should be putting the ,"" for the value iferror please?

  • Paul Newcome
    Paul Newcome ✭✭✭✭✭✭

    @EimearCIf you want to output a blank when there is no date, you will need to use a second IFERROR.


    =IFERROR(IFERROR(DATE(YEAR([Received Price List Date]@row), MONTH([Received Price List Date]@row) + 10, DAY([Received Price List Date]@row)), DATE(YEAR([Received Price List Date]@row) + 1, MONTH([Received Price List Date]@row) - 2, DAY([Received Price List Date]@row))), "")

  • EimearC
    EimearC ✭✭

    @Paul NewcomeYou're a genius! I didn't realise this could be done, thank you so much!

Help Article Resources

Want to practice working with formulas directly in Smartsheet?

Check out theFormula Handbook template!
Try this:<\/p>

=COUNTIFS([Item Number]:[Item Number], OR(@cell = \"C001\", @cell = \"COO2\", @cell = \"COO3\", @cell = \"COO4\"), [Status]:[Status], OR(@cell = \"Green\", @cell = \"Yellow\", @cell = \"Red\"))<\/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":[{"tagID":254,"urlcode":"formulas","name":"Formulas"}]},{"discussionID":109490,"type":"question","name":"HAS exact match within multiselect - Numbered Values","excerpt":"Scenario: Trying to identify a match if a value shows up in a multiselect from another sheet. Approach: I'm able to get 95% of this done through an index(collect(contains))) formula, but having some false positives show up wherever a partial match is found. I later found some suggestions that (has) would be more…","snippet":"Scenario: Trying to identify a match if a value shows up in a multiselect from another sheet. Approach: I'm able to get 95% of this done through an index(collect(contains)))…","categoryID":322,"dateInserted":"2023-08-25T19:26:32+00:00","dateUpdated":null,"dateLastComment":"2023-08-26T00:49:48+00:00","insertUserID":154049,"insertUser":{"userID":154049,"name":"Rob W.","url":"https:\/\/community.smartsheet.com\/profile\/Rob%20W.","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/defaultavatar\/nWRMFRX6I99I6.jpg","dateLastActive":"2023-08-26T00:49:37+00:00","banned":0,"punished":0,"private":false,"label":"✭"},"updateUserID":null,"lastUserID":154049,"lastUser":{"userID":154049,"name":"Rob W.","url":"https:\/\/community.smartsheet.com\/profile\/Rob%20W.","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/defaultavatar\/nWRMFRX6I99I6.jpg","dateLastActive":"2023-08-26T00:49:37+00:00","banned":0,"punished":0,"private":false,"label":"✭"},"pinned":false,"pinLocation":null,"closed":false,"sink":false,"countComments":2,"countViews":18,"score":null,"hot":3386003780,"url":"https:\/\/community.smartsheet.com\/discussion\/109490\/has-exact-match-within-multiselect-numbered-values","canonicalUrl":"https:\/\/community.smartsheet.com\/discussion\/109490\/has-exact-match-within-multiselect-numbered-values","format":"Rich","lastPost":{"discussionID":109490,"commentID":392694,"name":"Re: HAS exact match within multiselect - Numbered Values","url":"https:\/\/community.smartsheet.com\/discussion\/comment\/392694#Comment_392694","dateInserted":"2023-08-26T00:49:48+00:00","insertUserID":154049,"insertUser":{"userID":154049,"name":"Rob W.","url":"https:\/\/community.smartsheet.com\/profile\/Rob%20W.","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/defaultavatar\/nWRMFRX6I99I6.jpg","dateLastActive":"2023-08-26T00:49:37+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\/KJPRLKL2FW16\/capture-png.png","urlSrcSet":{"10":"","300":"","800":"","1200":"","1600":""},"alt":"Capture.PNG"},"attributes":{"question":{"status":"accepted","dateAccepted":"2023-08-26T00:49:35+00:00","dateAnswered":"2023-08-25T23:58:23+00:00","acceptedAnswers":[{"commentID":392688,"body":"

Hi, <\/p>

Instead of applying the formula to \"Multiselect Text String\" row, did you tried with \"Multiselect Values\" row?<\/p>

=IF(HAS([Multiselect Values]@row, [Component ID]@row), \"MATCH\", \"NO MATCH\")<\/p>

Thank you,<\/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":109474,"type":"question","name":"Help with date calculation formula","excerpt":"Hello, I'm trying to find a formula that will help me calculate how long an intake took to resolve. The rows I need to be calculated are Date Reported & Resolution Date. If the resolution date is blank I want it to use the current date in the calculation to see how long this issue has gone unresolved. Any help is much…","snippet":"Hello, I'm trying to find a formula that will help me calculate how long an intake took to resolve. The rows I need to be calculated are Date Reported & Resolution Date. If the…","categoryID":322,"dateInserted":"2023-08-25T16:29:39+00:00","dateUpdated":"2023-08-25T16:29:59+00:00","dateLastComment":"2023-08-25T23:01:30+00:00","insertUserID":165688,"insertUser":{"userID":165688,"name":"Nwest","title":"Systems Analyst","url":"https:\/\/community.smartsheet.com\/profile\/Nwest","photoUrl":"https:\/\/aws.smartsheet.com\/storageProxy\/image\/images\/u!1!ukHVZ18ImX4!BcjWAe8S9SY!l7iQo_PZHOx","dateLastActive":"2023-08-25T17:22:30+00:00","banned":0,"punished":0,"private":false,"label":"✭"},"updateUserID":165688,"lastUserID":8888,"lastUser":{"userID":8888,"name":"Andrée Starå","title":"Smartsheet Expert Consultant & Partner | Workflow Consultant \/ CEO @ WORK BOLD","url":"https:\/\/community.smartsheet.com\/profile\/Andr%C3%A9e%20Star%C3%A5","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/userpics\/0PAU3GBYQLBT\/nXWM7QXGD6464.jpg","dateLastActive":"2023-08-26T17:06:33+00:00","banned":0,"punished":0,"private":false,"label":"✭✭✭✭✭✭"},"pinned":false,"pinLocation":null,"closed":false,"sink":false,"countComments":3,"countViews":23,"score":null,"hot":3385987269,"url":"https:\/\/community.smartsheet.com\/discussion\/109474\/help-with-date-calculation-formula","canonicalUrl":"https:\/\/community.smartsheet.com\/discussion\/109474\/help-with-date-calculation-formula","format":"Rich","tagIDs":[254],"lastPost":{"discussionID":109474,"commentID":392687,"name":"Re: Help with date calculation formula","url":"https:\/\/community.smartsheet.com\/discussion\/comment\/392687#Comment_392687","dateInserted":"2023-08-25T23:01:30+00:00","insertUserID":8888,"insertUser":{"userID":8888,"name":"Andrée Starå","title":"Smartsheet Expert Consultant & Partner | Workflow Consultant \/ CEO @ WORK BOLD","url":"https:\/\/community.smartsheet.com\/profile\/Andr%C3%A9e%20Star%C3%A5","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/userpics\/0PAU3GBYQLBT\/nXWM7QXGD6464.jpg","dateLastActive":"2023-08-26T17:06:33+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-25T17:04:22+00:00","dateAnswered":"2023-08-25T16:36:59+00:00","acceptedAnswers":[{"commentID":392622,"body":"

\n \n https:\/\/community.smartsheet.com\/discussion\/109474\/help-with-date-calculation-formula\n <\/a>\n<\/div>\n

Hi, <\/p>

I hope you're well and safe!<\/p>

Try something like this.<\/p>

=IF([Date Reported]@row <> \"//www.santa-greenland.com/community/discussion/comment/\", IF([Resolution Date]@row = \"//www.santa-greenland.com/community/discussion/comment/\", NETDAYS([Date Reported]@row, TODAY()), NETDAYS([Date Reported]@row, [Resolution Date]@row)))<\/p>

Did that work\/help? <\/p>

I hope that helps!<\/p>

Be safe, and have a fantastic weekend!<\/p>

Best,<\/p>

Andrée Starå<\/strong><\/a> | Workflow Consultant \/ CEO @ WORK BOLD<\/strong><\/a><\/p>

Did my post(s) help or answer your question or solve your problem? Please support the Community by <\/em>marking it Insightful\/Vote Up, Awesome, or\/and as the accepted answer<\/em><\/strong>. It will make it easier for others to find a solution or help to answer!<\/em><\/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":[{"tagID":254,"urlcode":"formulas","name":"Formulas"}]}],"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