Creating a formula to track number of days but with a catch

CRUSJ
CRUSJ
edited 10/17/22 inFormulas and Functions

So I have been tasked with creating a formula that tracks the number of days an element is "No". However, there are multiple forms submitted each day so I do not want to count the number of times a "No" is selected. It needs to be a formula that counts the consecutive days but then resets to 0 if the element has a "Yes" selected instead.

I know that there will be a COUNTIF(DATE in here but im not sure how to avoid counting the number of entries of "No" instead of the consecutive days.

Smartsheet forum 7.png

So based on the screenshot--Element 1 should be 4 days, Element 2 should be 0 days and Element 3 should be 4 days. Essentially once an element receives a "Yes" that means the item is up and running again and the formula should reset to a 0.

Tags:

Answers

Help Article Resources

Want to practice working with formulas directly in Smartsheet?

Check out theFormula Handbook template!
In that case you would replace<\/p>

{Cross Sheet Reference}<\/p>


<\/p>

with<\/p>

[Column name]:[Column Name]<\/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":112222,"type":"question","name":"Count Days and Durations","excerpt":"I am looking to count days used in my schedule per task. I am set up with start and finish date columns along with a duration column. I am trying to calculate days on site from start date to today, but to stop counting days when finish date is reached.","snippet":"I am looking to count days used in my schedule per task. I am set up with start and finish date columns along with a duration column. I am trying to calculate days on site from…","categoryID":322,"dateInserted":"2023-10-26T17:03:59+00:00","dateUpdated":null,"dateLastComment":"2023-10-27T15:15:39+00:00","insertUserID":164388,"insertUser":{"userID":164388,"name":"Caleb W","title":"Operations Leader","url":"https:\/\/community.smartsheet.com\/profile\/Caleb%20W","photoUrl":"https:\/\/lh3.googleusercontent.com\/a-\/AFdZucpGLwolOKyzvAL1Qwa-C_qqnmxB9j9mfmL4qM8Hnw=s96-c","dateLastActive":"2023-10-27T17:19:12+00:00","banned":0,"punished":0,"private":false,"label":"✭✭"},"updateUserID":null,"lastUserID":113581,"lastUser":{"userID":113581,"name":"Matthew J McAteer","url":"https:\/\/community.smartsheet.com\/profile\/Matthew%20J%20McAteer","photoUrl":"https:\/\/aws.smartsheet.com\/storageProxy\/image\/images\/u!1!zDFUs7dXyHo!7bFXOzNnVPw!fm5dCHPC2D9","dateLastActive":"2023-10-27T16:03:18+00:00","banned":0,"punished":0,"private":false,"label":"✭✭✭"},"pinned":false,"pinLocation":null,"closed":false,"sink":false,"countComments":5,"countViews":39,"score":null,"hot":3396762578,"url":"https:\/\/community.smartsheet.com\/discussion\/112222\/count-days-and-durations","canonicalUrl":"https:\/\/community.smartsheet.com\/discussion\/112222\/count-days-and-durations","format":"Rich","lastPost":{"discussionID":112222,"commentID":402031,"name":"Re: Count Days and Durations","url":"https:\/\/community.smartsheet.com\/discussion\/comment\/402031#Comment_402031","dateInserted":"2023-10-27T15:15:39+00:00","insertUserID":113581,"insertUser":{"userID":113581,"name":"Matthew J McAteer","url":"https:\/\/community.smartsheet.com\/profile\/Matthew%20J%20McAteer","photoUrl":"https:\/\/aws.smartsheet.com\/storageProxy\/image\/images\/u!1!zDFUs7dXyHo!7bFXOzNnVPw!fm5dCHPC2D9","dateLastActive":"2023-10-27T16:03:18+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\/JDZDOA0P3L7I\/image.png","urlSrcSet":{"10":"https:\/\/us.v-cdn.net\/cdn-cgi\/image\/fit=scale-down,width=10\/https:\/\/us.v-cdn.net\/6031209\/uploads\/JDZDOA0P3L7I\/image.png","300":"https:\/\/us.v-cdn.net\/cdn-cgi\/image\/fit=scale-down,width=300\/https:\/\/us.v-cdn.net\/6031209\/uploads\/JDZDOA0P3L7I\/image.png","800":"https:\/\/us.v-cdn.net\/cdn-cgi\/image\/fit=scale-down,width=800\/https:\/\/us.v-cdn.net\/6031209\/uploads\/JDZDOA0P3L7I\/image.png","1200":"https:\/\/us.v-cdn.net\/cdn-cgi\/image\/fit=scale-down,width=1200\/https:\/\/us.v-cdn.net\/6031209\/uploads\/JDZDOA0P3L7I\/image.png","1600":"https:\/\/us.v-cdn.net\/cdn-cgi\/image\/fit=scale-down,width=1600\/https:\/\/us.v-cdn.net\/6031209\/uploads\/JDZDOA0P3L7I\/image.png"},"alt":"image.png"},"attributes":{"question":{"status":"accepted","dateAccepted":"2023-10-27T17:19:33+00:00","dateAnswered":"2023-10-26T22:22:24+00:00","acceptedAnswers":[{"commentID":401941,"body":"

Hi @Caleb W<\/a> <\/p>

Sure, try this: =IFERROR(IF(AND([Start Date]@row <= TODAY(), [End Date]@row > TODAY()), NETWORKDAYS([Start Date]@row, TODAY()), IF(AND([Start Date]@row <= TODAY(), [End Date]@row <= TODAY()), NETWORKDAYS([Start Date]@row, [End Date]@row), \"0\")), \"//www.santa-greenland.com/community/discussion/comment/\")<\/p>

Once you add the formula to a cell, you can right click and convert the formula to a column formula.<\/p>

Hope that helps 😊<\/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":112244,"type":"question","name":"Countifs formula","excerpt":"Hi Team reaching out for some help again, i need a countifs formula to count all the high priority actions (Priority column) that are currently either not started or ongoing (Status column) Thanks in advance","snippet":"Hi Team reaching out for some help again, i need a countifs formula to count all the high priority actions (Priority column) that are currently either not started or ongoing…","categoryID":322,"dateInserted":"2023-10-27T02:53:17+00:00","dateUpdated":null,"dateLastComment":"2023-10-27T04:03:23+00:00","insertUserID":158264,"insertUser":{"userID":158264,"name":"Hobo","title":"","url":"https:\/\/community.smartsheet.com\/profile\/Hobo","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/userpics\/ZLW3ELEW8RGX\/nZR392EQUH89I.jpg","dateLastActive":"2023-10-27T08:27:18+00:00","banned":0,"punished":0,"private":false,"label":"✭"},"updateUserID":null,"lastUserID":158264,"lastUser":{"userID":158264,"name":"Hobo","title":"","url":"https:\/\/community.smartsheet.com\/profile\/Hobo","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/userpics\/ZLW3ELEW8RGX\/nZR392EQUH89I.jpg","dateLastActive":"2023-10-27T08:27:18+00:00","banned":0,"punished":0,"private":false,"label":"✭"},"pinned":false,"pinLocation":null,"closed":false,"sink":false,"countComments":2,"countViews":17,"score":null,"hot":3396755800,"url":"https:\/\/community.smartsheet.com\/discussion\/112244\/countifs-formula","canonicalUrl":"https:\/\/community.smartsheet.com\/discussion\/112244\/countifs-formula","format":"Rich","lastPost":{"discussionID":112244,"commentID":401963,"name":"Re: Countifs formula","url":"https:\/\/community.smartsheet.com\/discussion\/comment\/401963#Comment_401963","dateInserted":"2023-10-27T04:03:23+00:00","insertUserID":158264,"insertUser":{"userID":158264,"name":"Hobo","title":"","url":"https:\/\/community.smartsheet.com\/profile\/Hobo","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/userpics\/ZLW3ELEW8RGX\/nZR392EQUH89I.jpg","dateLastActive":"2023-10-27T08:27:18+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\/MLV6R3XY3ELA\/image.png","urlSrcSet":{"10":"https:\/\/us.v-cdn.net\/cdn-cgi\/image\/fit=scale-down,width=10\/https:\/\/us.v-cdn.net\/6031209\/uploads\/MLV6R3XY3ELA\/image.png","300":"https:\/\/us.v-cdn.net\/cdn-cgi\/image\/fit=scale-down,width=300\/https:\/\/us.v-cdn.net\/6031209\/uploads\/MLV6R3XY3ELA\/image.png","800":"https:\/\/us.v-cdn.net\/cdn-cgi\/image\/fit=scale-down,width=800\/https:\/\/us.v-cdn.net\/6031209\/uploads\/MLV6R3XY3ELA\/image.png","1200":"https:\/\/us.v-cdn.net\/cdn-cgi\/image\/fit=scale-down,width=1200\/https:\/\/us.v-cdn.net\/6031209\/uploads\/MLV6R3XY3ELA\/image.png","1600":"https:\/\/us.v-cdn.net\/cdn-cgi\/image\/fit=scale-down,width=1600\/https:\/\/us.v-cdn.net\/6031209\/uploads\/MLV6R3XY3ELA\/image.png"},"alt":"image.png"},"attributes":{"question":{"status":"accepted","dateAccepted":"2023-10-27T09:32:13+00:00","dateAnswered":"2023-10-27T03:45:21+00:00","acceptedAnswers":[{"commentID":401961,"body":"

Hi @Hobo<\/a> ,<\/p>


<\/p>

You can use this formula. The formula will count rows where priority is high and status is not completed.<\/p>


<\/p>

=COUNTIFS(Priority:Priority, \"High\", Status:Status, <> \"Completed\")<\/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