how to write formulas to get the answer of "?" in pic below.
The date are in string (manually typed)
I want to count how many different date in a month
for example 22-jan-20 and 21-jan-20 are counted as 2
Please help me for the smartsheet formula
Best Answer
-
Thank you for clarifying! Yes, in that case we would need to add in a DISTINCT function as well, to only count the unique times that this string appears while containing "Jan":
=COUNTIF(DISTINCT(Dates:Dates), CONTAINS("Jan", @cell))
Does this now meet all of your criteria?
Need more help? 👀 | Help and Learning Center
こんにちは (Konnichiwa), Hallo, Hola, Bonjour, Olá, Ciao! 👋 | Global Discussions
Answers
-
You can use a combination of a COUNTIF formula and a MONTH function (using IFERROR to get rid of any blank cells).
Try this for your January count:
=COUNTIF(Dates:Dates, IFERROR(MONTH(@cell), 0) = 1)
Then to change what month you're looking for, just change the 1 at the very end of the formula to be that month's number. For example, if I was looking for April, I'd use this:
=COUNTIF(Dates:Dates, IFERROR(MONTH(@cell), 0) = 4)
Let me know if this works for you!
Cheers,
Genevieve
Need more help? 👀 | Help and Learning Center
こんにちは (Konnichiwa), Hallo, Hola, Bonjour, Olá, Ciao! 👋 | Global Discussions
-
My apologies Michael, I just read that your dates are in a string, not in a Date Type of column. The formula above is for a Date Type of column.
In this instance, you would need to use CONTAINS to check and see if your dates column contains a certain word. Please note that I've titled my column "Dates" for the range, so you will need to swap this out for your current date column name:
=COUNTIF(Dates:Dates, CONTAINS("Jan", @cell))
Then for each Month, you would want to change the value "in these" that you are searching for:
=COUNTIF(Dates:Dates, CONTAINS("Apr", @cell))
Cheers,
Genevieve
Need more help? 👀 | Help and Learning Center
こんにちは (Konnichiwa), Hallo, Hola, Bonjour, Olá, Ciao! 👋 | Global Discussions
-
Thank you for responding
The formula doesn't work. But even if it is working, I don't think that I will get the answer that I want.
If you look at the example pic, there are 3 "January" but only 2 with different date.
I don't want to count the same date.
-
This one works, but it will count month with the same date.
The problem is I don't want to count multiple date
-
Thank you for clarifying! Yes, in that case we would need to add in a DISTINCT function as well, to only count the unique times that this string appears while containing "Jan":
=COUNTIF(DISTINCT(Dates:Dates), CONTAINS("Jan", @cell))
Does this now meet all of your criteria?
Need more help? 👀 | Help and Learning Center
こんにちは (Konnichiwa), Hallo, Hola, Bonjour, Olá, Ciao! 👋 | Global Discussions
-
Marvelous, this works well. I know that it will work with distinct, but apparently I'm not smart enough to write it in this order.
Thank you very much!!! Really appreciate your help.
🍪 here's a cookie for you.
-
Haha no problem at all! Thank you for the cookie 😋
Need more help? 👀 | Help and Learning Center
こんにちは (Konnichiwa), Hallo, Hola, Bonjour, Olá, Ciao! 👋 | Global Discussions
Help Article Resources
Categories
- All Categories
- 14 Welcome to the Community
- Smartsheet Customer Resources
- 64.2K Get Help
- 419 Global Discussions
- 221 Industry Talk
- 461 Announcements
- 4.8K Ideas & Feature Requests
- 143 Brandfolder
- 142 Just for fun
- 58 Community Job Board
- 462 Show & Tell
- 32 Member Spotlight
- 1 SmartStories
- 299 Events
- 38 Webinars
- 7.3K Forum Archives
Check out the Formula Handbook template!