Welcome to the Smartsheet Forum Archives
The posts in this forum are no longer monitored for accuracy and their content may no longer be current. If there's a discussion here that interests you and you'd like to find (or create) a more current version, pleaseVisit the Current Forums.
CountIF between 2 dates
Hello!
I'm trying to count the number of children whose "Final Approval Date" is between 6/1/17 and 10/1/17. I don't even know where to start with this formula. I know I've got my weekly totals like this:
=COUNTIF([FINAL APPROVAL DATE]:[FINAL APPROVAL DATE], AND(@cell<= TODAY(7),@cell> TODAY(-7)))
Any help is appreciated!
Thanks!
Amy
Comments
-
JamesR ✭✭✭✭✭✭
艾米,
Often it is useful to create a hidden Checkbox Column than has the Criteria Formula in it to check if it matches. You can then use a formula to count the ticks.
-
aelmore ✭
Hi JamesR!
Happy New Year! That's a great idea. I'll definitely do that. But I'm still not sure how I would check the box if the "Final Approval Date" column is between 2 dates...
=IF(([FINAL APPROVAL DATE],[email protected]<= ???,@cell> ???), 1,0)
I don't know how to show a specific date in a formula rather than a "TODAY" value. I'll be extremely excited when I can use formulas in Reports!
Thanks for your help!
Amy
-
JamesR ✭✭✭✭✭✭
The Uploaded image should give you an idea as to how to use the Checkbox and to count them.
-
Robert S. Employee
Hello Amy,
Thanks for the question. JamesR is right that this method can often be useful, however this calculation is also possible using a single formula without adding a column of checkboxes. This formula can be written very similarly to your weekly totals formula, and would look something like this:
(最终批准日期)=条件统计(儿童(1),@cell>= DATE(2017, 6, 1), CHILDREN([Final Approval Date]1),@cell< DATE(2017, 10, 1))
This will work if it's placed in a text/number column, however if you'd like to put this formula in the parent row and same column the dates are in (Final Approval Date), you can write it something like this instead:
=COUNTIFS(CHILDREN(),@cell>= DATE(2017, 6, 1), CHILDREN(),@cell< DATE(2017, 10, 1)) + ""
Since this is in the parent cell being referenced in the CHILDREN() function, you don't need to include anything within the CHILDREN()'s parentheses. Also, since this column is a date column and the result is a number, I've added + "" to the end to convert the result into text rather than a number so that you don't get a #DATE EXPECTED error. More on formula errors can be found here (https://help.smartsheet.com/articles/2476176).
-
JamesR ✭✭✭✭✭✭
Robert,
You are correct, I suggested my method as an alternative for those who struggle with the complexity of nested or multi parameter formula.
Additionally having these interim calculation can allow the user to reuse in other Formula.
-
aelmore ✭
This is exactly what I needed! Thanks so much!
Amy
Categories
Give this a try:<\/p>
=COUNTIFS([Warranty Phase]:[Warranty Phase], \"Move in Items\", [Status]:[Status], OR(@cell = \"In Progress\", @cell = \"Not Started\"))<\/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":107571,"type":"question","name":"Yellow Code Not Working in Formula","excerpt":"I have the underlying code in a sheet to look at specific items in a row. The Red and Green Code is working as expected by my yellow code is not. I am assuming it has to do with the way I have sestup the today function I have tried both =TODAY(2) and >=TODAY(2) niether seems to work. IF(AND([Due Date]@row = TODAY(2),…","snippet":"I have the underlying code in a sheet to look at specific items in a row. The Red and Green Code is working as expected by my yellow code is not. I am assuming it has to do with…","categoryID":322,"dateInserted":"2023-07-13T17:28:22+00:00","dateUpdated":null,"dateLastComment":"2023-07-13T21:58:08+00:00","insertUserID":162256,"insertUser":{"userID":162256,"name":"delaurellc","title":"Senior Consultant","url":"https:\/\/community.smartsheet.com\/profile\/delaurellc","photoUrl":"https:\/\/lh3.googleusercontent.com\/a\/AAcHTtf4bLRCxTWbiShmV4wW7Ah1awahmzvkEsk_gLoMMj4VnA=s96-c","dateLastActive":"2023-07-13T22:10:03+00:00","banned":0,"punished":0,"private":false,"label":"✭✭"},"updateUserID":null,"lastUserID":162256,"lastUser":{"userID":162256,"name":"delaurellc","title":"Senior Consultant","url":"https:\/\/community.smartsheet.com\/profile\/delaurellc","photoUrl":"https:\/\/lh3.googleusercontent.com\/a\/AAcHTtf4bLRCxTWbiShmV4wW7Ah1awahmzvkEsk_gLoMMj4VnA=s96-c","dateLastActive":"2023-07-13T22:10:03+00:00","banned":0,"punished":0,"private":false,"label":"✭✭"},"pinned":false,"pinLocation":null,"closed":false,"sink":false,"countComments":7,"countViews":30,"score":null,"hot":3378558990,"url":"https:\/\/community.smartsheet.com\/discussion\/107571\/yellow-code-not-working-in-formula","canonicalUrl":"https:\/\/community.smartsheet.com\/discussion\/107571\/yellow-code-not-working-in-formula","format":"Rich","lastPost":{"discussionID":107571,"commentID":385170,"name":"Re: Yellow Code Not Working in Formula","url":"https:\/\/community.smartsheet.com\/discussion\/comment\/385170#Comment_385170","dateInserted":"2023-07-13T21:58:08+00:00","insertUserID":162256,"insertUser":{"userID":162256,"name":"delaurellc","title":"Senior Consultant","url":"https:\/\/community.smartsheet.com\/profile\/delaurellc","photoUrl":"https:\/\/lh3.googleusercontent.com\/a\/AAcHTtf4bLRCxTWbiShmV4wW7Ah1awahmzvkEsk_gLoMMj4VnA=s96-c","dateLastActive":"2023-07-13T22:10:03+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-07-13T21:57:50+00:00","dateAnswered":"2023-07-13T20:00:01+00:00","acceptedAnswers":[{"commentID":385104,"body":"
Try this:<\/p>
=IF(Status@row <> \"Complete\", IF([Due Date]@row< TODAY(), \"Red\", IF([Due Date]@row>= TODAY(3), \"Green\", \"Yellow\"))<\/p>
<\/p>
The main issue with your formula is that you are saying to only flag yellow when the due date is equal to TODAY(2) instead of less than or equal to.<\/p>"},{"commentID":385144,"body":"
There are a number of ways to do this. The most secure way would actually mean a restructure and an OR statement:<\/p>
=IF(Status@row <> \"Complete\", IF(OR([Due Date]@row = \"\", [Due Date]@row.= TODAY(3)), \"Green\", IF([Due Date]@row< TODAY(), \"Red\", \"Yellow\"))<\/p>
<\/p>
I moved the Green argument to be first because sometimes Smartsheet will read a blank cell as being less than a non-blank cell. If we had left it in the original order, this would have meant it would flag as true on the red argument when the due date was blank.<\/p>
<\/p>
Of course there are a number of other ways to do it, but this would be my personally preferred method.<\/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&includeChildCategories=1&type%5B0%5D=Question&excludeHiddenCategories=1&siteSectionID=0&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 Posts","subtitle":null,"description":null,"noCheckboxes":true,"containerOptions":[],"discussionOptions":[]}">