Countif – Quick Tip

Here’s a few neat ways to count Text, Blanks and Non-Blank cells using the Countif() function.

Count All Non-Blanks

Countif1

 

Count All Text

Countif2a

 

Count All Blanks

Countif3a

 

Download

You can download a sample of the above Countif_Quicktips

 

Learn More about the Countif() function

http://chandoo.org/excel-formulas/countif.shtml

Sumifs()  a close relation to Countifs()

Facebook
Twitter
LinkedIn

Share this tip with your colleagues

Excel and Power BI tips - Chandoo.org Newsletter

Get FREE Excel + Power BI Tips

Simple, fun and useful emails, once per week.

Learn & be awesome.

Welcome to Chandoo.org

Thank you so much for visiting. My aim is to make you awesome in Excel & Power BI. I do this by sharing videos, tips, examples and downloads on this website. There are more than 1,000 pages with all things Excel, Power BI, Dashboards & VBA here. Go ahead and spend few minutes to be AWESOME.

Read my storyFREE Excel tips book

Overall I learned a lot and I thought you did a great job of explaining how to do things. This will definitely elevate my reporting in the future.
Rebekah S
Reporting Analyst
Excel formula list - 100+ examples and howto guide for you

From simple to complex, there is a formula for every occasion. Check out the list now.

Calendars, invoices, trackers and much more. All free, fun and fantastic.

Advanced Pivot Table tricks

Power Query, Data model, DAX, Filters, Slicers, Conditional formats and beautiful charts. It's all here.

Still on fence about Power BI? In this getting started guide, learn what is Power BI, how to get it and how to create your first report from scratch.

20 Responses

  1. Be very careful with =COUNTIF(B2:B9,”><"). If you insert the following text into B2:B9, the formula returns 0 which is incorrect. Better to use =COUNTIF(B2:B9,"*").

    "
    #
    $
    %
    &
    '
    (
    )

    1. Jason,

      Good catch. One more thing that I tried.. If you insert =”” in one of the cells, “*” still counts it as non-blank (this is sometimes the case with imported data)

      I prefer “?*” as it ensures the cell has atleast one character

    1. Pavi,

      I’ve always used something like: =COUNTIF(B2:B9,”>”&0)

      But generally, I want to find that meet certain criteria. If you just wanted all numbers, regardless of value, you could use:
      =SUMPRODUCT(–ISNUMBER(A2:A9))

      If you wanted to return only values that met conditions using SUMPRODUCT, you’d use something like:
      =SUMPRODUCT(–(A2:A9>110000),–ISNUMBER(A2:A9))

      Without the ISNUMBER() clause, SUMPRODUCT will also count your text cells.

  2. The “><" isn't quite doing what the post implies.

    It is counting cells where the character code is greater than that of the < symbol, with the character code for the < symbol being 60.

    So, if you just put an exclamation mark (!) in a cell, the formula wouldn't count it because the character code for ! is 33. This is what Jason highlighted a couple of posts ago.

    @Pavi, just use the COUNT() function.
    =COUNT(B2:B9)

  3. Also be careful with this: COUNTIF(B2:B9,”=”) because it treats cells with formula =”” as non-empty cells.
    COUNTIF(B2:B9,””) is better because it counts empty cells and also cells with empty text string (“”).

  4. We are trying to use COUNTIF function to find blank and non-blank cells, which is creative and fine.

    However, we can also use COUNTA() to count non-blank cells and COUNTBLANK() to count blank cells. These are very specific functions to do the same work.

  5. What are the best CountIf options for text, number and blank using the data in B2:B9 if the data in each cell, including the blank, was generated with a formula?

  6. Also we can try out this thing as well

    1. =COUNTIF(C28:C31,”Band”)..will return 2 by exact match between the cell range
    2. =COUNTIF(C28:C31,”*and”)..will return 2 by exact match between the cell range containing “Band”,”Rand”
    3. =COUNTIF(C28:C31,”*and”)..will return 1 by exact match between the cell range containing “Band”,”Rnd”

    Good luck!!

  7. to exclude the “” for the count but count other texts, you could use:
    =COUNTIF(B2:B9,”>”””)

    doesn’t count numbers though.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.