Calculating Days

Hello

How do i get this formula to Calculating the numbers of Days when i select the date columns.

e.g I want to select the dates and then it calculates the number of days from the two date ranges selected.

Capture.JPG

Answers

  • Mike Wilday
    Mike Wilday ✭✭✭✭✭✭

    Do you want workdays or calendar days?

    Work Days =networkdays([Date Column 1]24, [Date Column 2]24)

    Calendar Days =netdays([Date Column 1]24, [Date Column 2]24)

    replace the Date Column 1 and Date Column 2 with the actual column name. 24 assumes this is row 24.

    https://help.smartsheet.com/function/netdays

    https://help.smartsheet.com/function/networkdays

    Enjoy.

  • I'm trying to do this and I keep getting the result of #INVALID DATA TYPE. I've checked my helper column properties, and both are "date". They have been defaulted to MM/DD/YY by smartsheet. Do I need a different date layout for the formula to work?

    On a side note, when I originally import the data, my dates include timestamps, but because I know smartsheet doesn't play well with time, I've taken to adding helper columns that change it to just the date format... could the helper columns be the issue here?

  • Paul Newcome
    Paul Newcome ✭✭✭✭✭✭

    @JLKIt depends on what formula(s) you have in your helper columns. What formula(s) are you using exactly?

    10xViz.com

    Come see me at ENGAGE 2023! I have "Happy to help" buttons!

    If you can't find me roaming the floor, I will most likely be at the 10xViz Partner Booth.

  • JLK
    JLK
    edited 09/13/23

    Hi Paul,

    Thanks for helping me figure this out. My formula for the helper column is:

    =[name of column]@row

    which should return exactly whats in my original date + timestamp column (formatted as: YYYY-MM-DD 00:00:00), but then I apply the column property of date and it returns just the MM/DD/YY

    如果有一个更好的方法来做这个我all ears.

  • Paul Newcome
    Paul Newcome ✭✭✭✭✭✭
    Hi Paul, <\/p>

    Thanks for helping me figure this out. My formula for the helper column is:<\/p>

    =[name of column]@row <\/p>

    which should return exactly whats in my original date + timestamp column (formatted as: YYYY-MM-DD 00:00:00), but then I apply the column property of date and it returns just the MM\/DD\/YY<\/p>

    If there is a better way to do this I'm all ears.<\/p>","bodyRaw":"[{\"insert\":\"Hi Paul, \\nThanks for helping me figure this out. My formula for the helper column is:\\n =[name of column]@row \\nwhich should return exactly whats in my original date + timestamp column (formatted as: YYYY-MM-DD 00:00:00), but then I apply the column property of date and it returns just the MM\\\/DD\\\/YY\\nIf there is a better way to do this I'm all ears.\\n\"}]","format":"rich","dateInserted":"2023-09-13T20:47:55+00:00","insertUser":{"userID":154948,"name":"JLK","url":"https:\/\/community.smartsheet.com\/profile\/JLK","photoUrl":"https:\/\/lh3.googleusercontent.com\/a\/AAcHTtdMXJoTwbuoFe9tx7PM4y3F4xufXqlfzJSptMyy0fAKAZo=s96-c","dateLastActive":"2023-09-18T14:34:40+00:00","banned":0,"punished":0,"private":false,"label":"✭"},"displayOptions":{"showUserLabel":false,"showCompactUserInfo":true,"showDiscussionLink":false,"showPostLink":false,"showCategoryLink":false,"renderFullContent":false,"expandByDefault":false},"url":"https:\/\/community.smartsheet.com\/discussion\/comment\/395225#Comment_395225","embedType":"quote"}"> https://community.smartsheet.com/discussion/comment/395225#Comment_395225

    Are you able to provide some screenshots for context?

    10xViz.com

    Come see me at ENGAGE 2023! I have "Happy to help" buttons!

    If you can't find me roaming the floor, I will most likely be at the 10xViz Partner Booth.

  • Here is the column as imported:

    Screenshot 2023-09-14 at 10.17.16 AM.png


    And here is the helper column formula: =[date applied (UCT)]@row

    And here is what the helper returns:

    Screenshot 2023-09-18 at 6.19.34 AM.png


    It used to not return the time, but when I logged back in to get you these screenshots, the time appears to still be there, so probably the first step is getting rid of the times?

  • Paul Newcome
    Paul Newcome ✭✭✭✭✭✭

    So even though you are using a date column, you are still only populating a text string. To get just the date pulled out of the string and stored as a date value, you would use something like this:

    =DATE(VALUE(LEFT([date applied (UTC)]@row, 4)), VALUE(MID([date applied (UTC)]@row, 6, 2)), VALUE(MID([date applied (UTC)]@row, 8, 2)))

    10xViz.com

    Come see me at ENGAGE 2023! I have "Happy to help" buttons!

    If you can't find me roaming the floor, I will most likely be at the 10xViz Partner Booth.

帮助文章资源欧宝体育app官方888

Want to practice working with formulas directly in Smartsheet?

Check out theFormula Handbook template!
Hi @RickyT<\/a> <\/p>

See if this formula helps:<\/p>

=COUNTIF(Projects:Projects, CONTAINS(\"MTS\", @cell))<\/p>

Hope this helps!<\/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":110703,"type":"question","name":"Column formula is not working.","excerpt":"Hello, I'm currently struggling with a column formula that, surprisingly, doesn't refer to any cell or range. Despite its simplicity, it's not functioning as expected. Here's the formula I'm working on: =IF(AND($[New break option date]@row >= [EndJanuary24]#, $[Contract start date]@row < [EndJanuary24]#), $[monthly rent…","snippet":"Hello, I'm currently struggling with a column formula that, surprisingly, doesn't refer to any cell or range. Despite its simplicity, it's not functioning as expected. Here's the…","categoryID":322,"dateInserted":"2023-09-24T14:30:03+00:00","dateUpdated":null,"dateLastComment":"2023-09-24T15:55:44+00:00","insertUserID":167283,"insertUser":{"userID":167283,"name":"VirgilT","title":"CEO","url":"https:\/\/community.smartsheet.com\/profile\/VirgilT","photoUrl":"https:\/\/lh3.googleusercontent.com\/a\/ACg8ocKob-3bU1Y_H3yPdYcq2P5SJvthlxNHPqJwxbXEW88bi-Xs=s96-c","dateLastActive":"2023-09-25T01:01:20+00:00","banned":0,"punished":0,"private":false,"label":"✭"},"updateUserID":null,"lastUserID":167283,"lastUser":{"userID":167283,"name":"VirgilT","title":"CEO","url":"https:\/\/community.smartsheet.com\/profile\/VirgilT","photoUrl":"https:\/\/lh3.googleusercontent.com\/a\/ACg8ocKob-3bU1Y_H3yPdYcq2P5SJvthlxNHPqJwxbXEW88bi-Xs=s96-c","dateLastActive":"2023-09-25T01:01:20+00:00","banned":0,"punished":0,"private":false,"label":"✭"},"pinned":false,"pinLocation":null,"closed":false,"sink":false,"countComments":2,"countViews":45,"score":null,"hot":3391137947,"url":"https:\/\/community.smartsheet.com\/discussion\/110703\/column-formula-is-not-working","canonicalUrl":"https:\/\/community.smartsheet.com\/discussion\/110703\/column-formula-is-not-working","format":"Rich","lastPost":{"discussionID":110703,"commentID":396714,"name":"Re: Column formula is not working.","url":"https:\/\/community.smartsheet.com\/discussion\/comment\/396714#Comment_396714","dateInserted":"2023-09-24T15:55:44+00:00","insertUserID":167283,"insertUser":{"userID":167283,"name":"VirgilT","title":"CEO","url":"https:\/\/community.smartsheet.com\/profile\/VirgilT","photoUrl":"https:\/\/lh3.googleusercontent.com\/a\/ACg8ocKob-3bU1Y_H3yPdYcq2P5SJvthlxNHPqJwxbXEW88bi-Xs=s96-c","dateLastActive":"2023-09-25T01:01:20+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-09-25T08:08:06+00:00","dateAnswered":"2023-09-24T14:50:21+00:00","acceptedAnswers":[{"commentID":396712,"body":"

Hello @VirgilT<\/a> <\/p>

Column formulas do not allow absolute designations ($) or row numbers in the formula. Remove the dollar signs from in front of your row names and it should work.<\/p>

Kelly<\/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":110697,"type":"question","name":"AVERAGEIF and Quarters","excerpt":"Hello, I have two sheets: Sheet 1 - contains a column with \"PROD Release Dates\" and a 2nd column that contains a formula to calculate the \"Cycle Time Months\" it took to complete the work. Sheet 2 - contains 4 rows to show the Quarter start\/end dates for 2023. You will see this is referenced as \"[Quarter Date End]@row\" in…","snippet":"Hello, I have two sheets: Sheet 1 - contains a column with \"PROD Release Dates\" and a 2nd column that contains a formula to calculate the \"Cycle Time Months\" it took to complete…","categoryID":322,"dateInserted":"2023-09-23T14:10:10+00:00","dateUpdated":null,"dateLastComment":"2023-09-25T13:14:47+00:00","insertUserID":120627,"insertUser":{"userID":120627,"name":"Amy Evans","url":"https:\/\/community.smartsheet.com\/profile\/Amy%20Evans","photoUrl":"https:\/\/aws.smartsheet.com\/storageProxy\/image\/images\/u!1!w7NUtxNmBvw!pENV6QdfoXo!06xFD7vZJJC","dateLastActive":"2023-09-25T13:10:35+00:00","banned":0,"punished":0,"private":false,"label":"✭✭"},"updateUserID":null,"lastUserID":120627,"lastUser":{"userID":120627,"name":"Amy Evans","url":"https:\/\/community.smartsheet.com\/profile\/Amy%20Evans","photoUrl":"https:\/\/aws.smartsheet.com\/storageProxy\/image\/images\/u!1!w7NUtxNmBvw!pENV6QdfoXo!06xFD7vZJJC","dateLastActive":"2023-09-25T13:10:35+00:00","banned":0,"punished":0,"private":false,"label":"✭✭"},"pinned":false,"pinLocation":null,"closed":false,"sink":false,"countComments":2,"countViews":29,"score":null,"hot":3391127097,"url":"https:\/\/community.smartsheet.com\/discussion\/110697\/averageif-and-quarters","canonicalUrl":"https:\/\/community.smartsheet.com\/discussion\/110697\/averageif-and-quarters","format":"Rich","lastPost":{"discussionID":110697,"commentID":396758,"name":"Re: AVERAGEIF and Quarters","url":"https:\/\/community.smartsheet.com\/discussion\/comment\/396758#Comment_396758","dateInserted":"2023-09-25T13:14:47+00:00","insertUserID":120627,"insertUser":{"userID":120627,"name":"Amy Evans","url":"https:\/\/community.smartsheet.com\/profile\/Amy%20Evans","photoUrl":"https:\/\/aws.smartsheet.com\/storageProxy\/image\/images\/u!1!w7NUtxNmBvw!pENV6QdfoXo!06xFD7vZJJC","dateLastActive":"2023-09-25T13:10:35+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-09-26T00:07:03+00:00","dateAnswered":"2023-09-24T00:14:46+00:00","acceptedAnswers":[{"commentID":396706,"body":"

Hey @Amy Evans<\/a> <\/p>

The syntax smartsheet is expecting for an AverageIF is AVERAGEIF(range, criteria, [average_range]), where the first range is part of the range-criteria pair, and the last range is what needs to be averaged, if it is a different range than the first. Note an AverageIf will only support one criteria. If there are more criterion required to filter the data, one must swap to AVG(COLLECT). The AverageIf works for your case.<\/p>

AVERAGEIF({PROD Release Date},@cell<=[Quarter Date End]@row, {Cycle Time Months})<\/p>

Does this formula give you the expected result?<\/p>

Kelly<\/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