How to get a countif formula to work when counting a range of a # value
I am trying to count the # of a certain # in a column. But it gives me either an error message (invalid data type) or a "0". I think I have to use countif and value somehow.
TIA!
Best Answers
-
Hi,
I hope you're well and safe!
Try something like this. (replace the columns name)
=COUNTIFS(NumbersColumn:NumbersColumn, 10)
Did that work/help?
I hope that helps!
Be safe, and have a fantastic weekend!
Best,
Andrée Starå | Workflow Consultant / CEO @ WORK BOLD
✅Did my post(s) help or answer your question or solve your problem? Please support the Community by marking it Insightful/Vote Up, Awesome, or/and as the accepted answer. 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:andree@workbold.com | P: +46 (0) - 72 - 510 99 35
Feel free to contact me for help with Smartsheet, integrations, general workflow advice, or anything else.
-
You shouldn't need a VALUE function. Just the COUNTIF.
=COUNTIF([Column Name]:[Column Name], @cell = #)
Answers
-
Hi,
I hope you're well and safe!
Try something like this. (replace the columns name)
=COUNTIFS(NumbersColumn:NumbersColumn, 10)
Did that work/help?
I hope that helps!
Be safe, and have a fantastic weekend!
Best,
Andrée Starå | Workflow Consultant / CEO @ WORK BOLD
✅Did my post(s) help or answer your question or solve your problem? Please support the Community by marking it Insightful/Vote Up, Awesome, or/and as the accepted answer. 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:andree@workbold.com | P: +46 (0) - 72 - 510 99 35
Feel free to contact me for help with Smartsheet, integrations, general workflow advice, or anything else.
-
You shouldn't need a VALUE function. Just the COUNTIF.
=COUNTIF([Column Name]:[Column Name], @cell = #)
-
@Paul Newcome you are awesome. I was doing Andree's suggestion above which worked for a straight number, but not when the number is produced by a formula in the column. But yours worked! Thank you.
-
@Andrea_Thompson Happy to help. 👍️
COUNTIF should work on numbers populated by a formula, but it depends on exactly how they are populated and exactly how you are searching for that number. If you put a number in "quotes" it will be considered a text string. Since text and numbers are two different data types, searching for a number in a column populated with text (that just looks like numbers) will result in zero and the other way around.
So if the formula outputting the numbers you want to count has the numbers wrapped in "quotes", your COUNTIF would also need to have the number wrapped in "quotes", and if the formula outputting the numbers does not have "quotes" around them, then you wouldn't use them in the COUNTIF either.
Example:
=IF([Column Name]@row = "Something", "10")
The above will output a text string that just looks like the number 10.
=IF([Column Name]@row = "Something", 10)
The above will output the numerical value of 10.
Your COUNTIF would need to search for either text or numbers (quotes or no quotes) based on the populating formula's output.
-
Thank you for the explanation. I had tried both with and without quotations in case that was the issue. I also tried changing the function from the number column between a YEAR( formula and a LEFT( formula that produced the year a different way. But it seems that the = sign was necessary in the countif formula for both cases. Instead of =countif([Year of Issue]:[Year of Issue], 2020) or =countif([Year of Issue]:[Year of Issue], "2020")
This was the one that ultimately worked: =COUNTIF([Year of Issue]:[Year of Issue], =2020)
-
Another difference can come from the YEAR vs LEFT functions.
YEAR outputs numeric date. LEFT outputs text.
-
@Paul Newcome Hey Paul! I am using your above recommendation but am trying to pull count by a range of numbers.
First column I want to know how many people are between the age of 16-24 for each department. But all are coming up 0?
formula: =COUNTIFS({Hr Headcount Age}, @cell = 16 - 24, {Hr Headcount by line of business}, [DataPoints2]@row)
cross reference 1=
Cross reference 2=
-
Also @Paul Newcome I updated the formula to correct one for the age range but still coming up with 0
=COUNTIFS({Hr Headcount Age}, AND(@cell >= 16, @cell <= 24), {Hr Headcount by line of business}, [DataPoints2]@row)
-
@Krystal Garcia How exactly is the Age column being populated?
Help Article Resources
Categories
- All Categories
- 14 Welcome to the Community
- Customer Resources
- 64.9K Get Help
- 441 Global Discussions
- 140 Industry Talk
- 472 Announcements
- 4.9K Ideas & Feature Requests
- 129 Brandfolder
- 148 Just for fun
- 68 Community Job Board
- 496 Show & Tell
- 33 Member Spotlight
- 2 SmartStories
- 300 Events
- 36 Webinars
- 7.3K Forum Archives
Check out the Formula Handbook template!