Counting Dates within a Date column
Hi all,
I'm trying to set up a formula that counts specific dates within a date column, using the following approach:
=COUNTIF({Reference 1}, "31-12-2020")
It keeps returning 0 when there are least 4 dates within the target column that match the specified criteria.
Can anyone advise how I can fix this?
Many thanks in advance!
Best Answers
-
Bassam Khalil ✭✭✭✭✭✭
Is it allowed to you create new sheet, if so you can create summary sheet to make all the calculation you need and use a reference for the data you need in your calculation the structural source data sheet.
☑️Are you satisfied with my answer to your question? Please help the Community by marking it as an( Accepted Answer), and I will be grateful for your "Vote Up" or "Insightful"
-
Debbie Sawyer ✭✭✭✭✭✭
This works for me...
你绝对相信你什么呢is exactly what you have on your sheet, as I can't see anything wrong with your formula! :D
The reference seems to have changed from {REFERENCE1} to {Portfolio Plan Range 3} this is the same date column? or if it is different, clarify that it is a date column that you are pointing to and that you have set up the range in the current sheet and not just typed it in from another formula on a different sheet? (Each sheet need the cross sheet references re-defining - this would put up an unparseable error if the range had been copied from another sheet and not redefined)
=COUNTIFS({Portfolio Plan Range 3}, ISDATE(@cell), {Portfolio Plan Range 3}, AND(DAY(@cell) = 31, MONTH(@cell) = 12, YEAR(@cell) = 2020))
Try copying and pasting this one in to your sheet. (ensuring {Portfolio Plan Range 3} was defined and named on the current sheet.
Pop a screen shot up on it in place if you are still getting unparseable.
Good luck
Debbie
Answers
-
Bassam Khalil ✭✭✭✭✭✭
Hope you are fine, your problem is when you define the criteria in count formula as a text so the result for sure will be 0, to solve this problem create help column for the criteria and input in that column the date you need to count then the formula will work correctly, i create for you a sample please check the following screen shot:
1- Reference column & Date Column are Date type.
2- Count column is Text/Number type
3- the formula in count column =COUNTIFS([Date Column]:[Date Column], Reference@row)
☑️Are you satisfied with my answer to your question? Please help the Community by marking it as an( Accepted Answer), and I will be grateful for your "Vote Up" or "Insightful"
-
I'm very well thank you, I hope you are too. Thank you for replying to me and for your clarification. Unfortunately, due to the structural requirements of the source data, I cannot input helper columns.
Is there any other way I can work around this? I tried running a report isolating the dates in question, so that I could run a simple =COUNT formula, but it seems Smartsheet doesn't consider Reports to be referenceable.
Many thanks,
Gerhard
-
Bassam Khalil ✭✭✭✭✭✭
Is it allowed to you create new sheet, if so you can create summary sheet to make all the calculation you need and use a reference for the data you need in your calculation the structural source data sheet.
☑️Are you satisfied with my answer to your question? Please help the Community by marking it as an( Accepted Answer), and I will be grateful for your "Vote Up" or "Insightful"
-
I had thought of this option, but I was hoping to avoid duplication of data and use of multiple data sources.
Regardless, thank you again for your time and help, it is much appreciated!
Kind regards,
Gerhard Costa Pinto
-
Bassam Khalil ✭✭✭✭✭✭
You are welcome
☑️Are you satisfied with my answer to your question? Please help the Community by marking it as an( Accepted Answer), and I will be grateful for your "Vote Up" or "Insightful"
-
Andrée Starå ✭✭✭✭✭✭
To add to Bassam's excellent advice/answer.
You could add a helper date field in the Sheet Summary section and reference that in the formula instead.
Would that work/help?
I hope that helps!
Be safe and have a fantastic week!
Best,
Andrée Starå| Workflow Consultant / CEO @WORK BOLD
✅Did my post(s) help or answer your question or solve your problem? Please help the Community bymarking it as the accepted answer/helpful. It will make it easier for others to find a solution or help to answer!
SMARTSHEET EXPERT CONSULTANT & PARTNER
Andrée Starå| Workflow Consultant / CEO @WORK BOLD
W:www.workbold.com| E:[email protected]| P: +46 (0) - 72 - 510 99 35
Feel free to contact me about help with Smartsheet, integrations, general workflow advice, or something else entirely.
-
Debbie Sawyer ✭✭✭✭✭✭
Hi
I haven't visited the community for a while and I appreciate you have an accepted answer on this - I just wanted to add that you can achieve this without helper columns if you wanted to. I have created a little example for you. It works for me.
Hope this helps.
Kind regards
Debbie
-
Thank you so much for getting back to me and for your suggestion. I've just tried your suggestion and got an #UNPARSEABLE error.
Have I missed something? Please note, that I am referencing another sheet, butREFERENCE 1in the formula below is the date column in question.
=COUNTIF({REFERENCE 1},AND((DAY(@cell)=31,Month(@cell)=12,Year(@cell)=2020))
Kind regards,
Gerhard
-
Debbie Sawyer ✭✭✭✭✭✭
I believe you may have an extra ( in your formula...Try this
=COUNTIF({REFERENCE 1},AND(DAY(@cell)=31,Month(@cell)=12,Year(@cell)=2020))
-
Debbie Sawyer ✭✭✭✭✭✭
Just realised, if your cross sheet reference is referring to a column where there might be unfilled cells (Blank cells) then you might get an Invalid data type error return.
This formula fixes that:
=COUNTIFS({REFERENCE 1}, ISDATE(@cell), {REFERENCE 1}, AND(DAY(@cell) = 15, MONTH(@cell) = 12, YEAR(@cell) = 2020))
Hope this helps!
Kind regards
Debbie
-
Hi Debbie,
Thank you again for getting back to me! You were right in that the column being referenced has blank cells in it, however the proposed formula to solve this comes back as #UNPARSEABLE.
I'm fairly certain I got everything exactly as your formula, so I'm not sure why this isn't working.
=COUNTIFS({Portfolio Plan Range 3},ISDATE(@cell),{Portfolio Plan Range 3},AND(DAY(@cell)=31,MONTH(@cell)=12,Year(@cell)2020))
Any ideas?
Kind regards,
Gerhard
-
Debbie Sawyer ✭✭✭✭✭✭
This works for me...
你绝对相信你什么呢is exactly what you have on your sheet, as I can't see anything wrong with your formula! :D
The reference seems to have changed from {REFERENCE1} to {Portfolio Plan Range 3} this is the same date column? or if it is different, clarify that it is a date column that you are pointing to and that you have set up the range in the current sheet and not just typed it in from another formula on a different sheet? (Each sheet need the cross sheet references re-defining - this would put up an unparseable error if the range had been copied from another sheet and not redefined)
=COUNTIFS({Portfolio Plan Range 3}, ISDATE(@cell), {Portfolio Plan Range 3}, AND(DAY(@cell) = 31, MONTH(@cell) = 12, YEAR(@cell) = 2020))
Try copying and pasting this one in to your sheet. (ensuring {Portfolio Plan Range 3} was defined and named on the current sheet.
Pop a screen shot up on it in place if you are still getting unparseable.
Good luck
Debbie
-
Debbie, not exactly sure what changed but this did it! Thank you so much!!
-
Debbie Sawyer ✭✭✭✭✭✭
Yay!
The only thing I could see was that Year was mixed case and not caps - but I can't imagine that was the error!
Glad it is working for you.
Kind regards
Debbie
Help Article Resources
Categories
I figured it out! Updated formula to get the 2 decimal places as well.<\/p>
=\"We are at \" + IFERROR(ROUND([% closed rate]@row * 100, 2), \"//www.santa-greenland.com/community/discussion/73786/\") + \"% closed rate on ticket status for the month of \" + Month@row<\/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":108861,"type":"question","name":"IF\/AND Formula","excerpt":"Formulas are the bane of my existence and I really need to take a class! Today I'm trying to set up a formula to throw a flag when 2 conditions are met. I want a red ball when I have not received an invoice and the invoice due date is within 30 days. I know I'm close since I've gone from \"unparsable\" to \"incorrect…","snippet":"Formulas are the bane of my existence and I really need to take a class! Today I'm trying to set up a formula to throw a flag when 2 conditions are met. I want a red ball when I…","categoryID":322,"dateInserted":"2023-08-11T16:27:44+00:00","dateUpdated":null,"dateLastComment":"2023-08-11T17:49:45+00:00","insertUserID":120231,"insertUser":{"userID":120231,"name":"Pamela Wagner","title":"","url":"https:\/\/community.smartsheet.com\/profile\/Pamela%20Wagner","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/defaultavatar\/nWRMFRX6I99I6.jpg","dateLastActive":"2023-08-11T17:47:38+00:00","banned":0,"punished":0,"private":false,"label":"✭✭✭✭✭✭"},"updateUserID":null,"lastUserID":120231,"lastUser":{"userID":120231,"name":"Pamela Wagner","title":"","url":"https:\/\/community.smartsheet.com\/profile\/Pamela%20Wagner","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/defaultavatar\/nWRMFRX6I99I6.jpg","dateLastActive":"2023-08-11T17:47:38+00:00","banned":0,"punished":0,"private":false,"label":"✭✭✭✭✭✭"},"pinned":false,"pinLocation":null,"closed":false,"sink":false,"countComments":4,"countViews":54,"score":null,"hot":3383549849,"url":"https:\/\/community.smartsheet.com\/discussion\/108861\/if-and-formula","canonicalUrl":"https:\/\/community.smartsheet.com\/discussion\/108861\/if-and-formula","format":"Rich","lastPost":{"discussionID":108861,"commentID":390268,"name":"Re: IF\/AND Formula","url":"https:\/\/community.smartsheet.com\/discussion\/comment\/390268#Comment_390268","dateInserted":"2023-08-11T17:49:45+00:00","insertUserID":120231,"insertUser":{"userID":120231,"name":"Pamela Wagner","title":"","url":"https:\/\/community.smartsheet.com\/profile\/Pamela%20Wagner","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/defaultavatar\/nWRMFRX6I99I6.jpg","dateLastActive":"2023-08-11T17:47:38+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-11T17:48:48+00:00","dateAnswered":"2023-08-11T17:12:43+00:00","acceptedAnswers":[{"commentID":390261,"body":"
You were, indeed, very close.<\/p>
=IF([Invoice Received?]@row = 0, IF(AND([Renewal Date]@row >= TODAY(), [Renewal Date]@row <= TODAY(+30)), \"Red\"))<\/p>"},{"commentID":390264,"body":"