How to get a countif formula to work when counting a range of a # value

Andrea_Thompson ✭✭✭
edited 08/18/23 in Formulas and Functions

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.


Best Answers


  • Andrée Starå
    Andrée Starå ✭✭✭✭✭✭
    Answer ✓


    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!


    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!


    Andrée Starå | Workflow Consultant / CEO @ WORK BOLD

    W: | E:[email protected] | P: +46 (0) - 72 - 510 99 35

    Feel free to contact me for help with Smartsheet, integrations, general workflow advice, or anything else.

  • Paul Newcome
    Paul Newcome ✭✭✭✭✭✭
    Answer ✓

    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.

  • Paul Newcome
    Paul Newcome ✭✭✭✭✭✭

    @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.


    =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.

  • Andrea_Thompson
    Andrea_Thompson ✭✭✭
    edited 08/21/23

    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)

  • Paul Newcome
    Paul Newcome ✭✭✭✭✭✭

    Another difference can come from the YEAR vs LEFT functions.

    YEAR outputs numeric date. LEFT outputs text.

Help Article Resources

Want to practice working with formulas directly in Smartsheet?

Check out the Formula Handbook template!