Count Non-Blank Cells in Excel (COUNTIF, COUNTA & More)

- Written by Puneet Gogia (Microsoft MVP)

80+ Excel Keyboard Shortcuts
✓ Verified in Excel 365 ✓ Excel 2021 ✓ Excel 2019 ✓ Google Sheets
Your Situation
Use This
Why
I just need a simple count of filled cells
COUNTA
Fastest — just specify the range, no criteria needed
I want to count truly non-blank cells only
COUNTIF
Use as the criteria to catch any cell with a value
I need to count non-blank with one extra condition
COUNTIFS
Supports multiple criteria in a single formula
Some cells look blank but have a space inside
COUNTIFS (two criteria)
Add a second condition to catch hidden space characters
I need OR logic across multiple conditions
SUMPRODUCT
The only method that handles OR logic cleanly
I don't want to write a formula at all
Status Bar
Select the range — the count appears instantly at the bottom
I am cleaning a large dataset and want to remove blanks
Power Query
Use Remove Empty Rows in the Transform tab — no formula needed

Let's say you are a teacher in a school and are working with data where you have student scores. When collecting test scores, some entries might be blank due to students being absent on the day of the test or because of errors in data entry.

Counting the number of cells not blank in the "Score" column helps the teacher identify the students who were present in the school on that day.

There are two primary ways to count the non-blank (non-empty) or the ones with value. These two methods are two pre-defined functions that you can use.

The first function is COUNTIF/COUNTIFS, and the other is COUNTA. Using any of these depends on your choice. In this tutorial, we will look at both the ways to do this.

student-scores.xlsx A B 1 Student Score 2 Alex 85 3 Maria 4 James 90 5 Priya 78 6 Tom 7 Sara 92 8 David 9 Lena 88 10 Chris 74 11 Nina 95 12

COUNTIF — Count Non-Blank Cells with the Not-Equal Operator

COUNTIF gives you more control than COUNTA. Instead of counting everything that is not empty, you are telling Excel exactly what condition to look for — in this case, cells that are not equal to blank.

Using the same student scores data, here is the formula:

=COUNTIF(B2:B11,"<>")
student-scores.xlsx — Excel C2 fx =COUNTIF(B2:B11,"<>") A B C 1 Student Score Non-Blank Count 2 Alex 85 7 3 Maria 4 James 90 5 Priya 78 6 Tom 7 Sara 92 8 David 9 Lena 88 10 Chris 74 11 Nina 95

Below are the steps you need to follow:

  1. Click on the cell where you want the result — in this example, that is cell C2.

  2. Type =COUNTIF( to start the formula.

  3. Select the range B2:B11 as the first argument — this is where your scores are.

  4. Add a comma, then type "<>" as the criteria.

  5. Close the parenthesis and press Enter.

The moment you hit Enter, Excel returns 7. The <> operator means "not equal to." When you pair it with nothing after it, Excel reads it as "not equal to blank" and counts every cell that has a value in it.

You can also write the formula this way, which means exactly the same thing:

=COUNTIF(B2:B11,"<>"&"")
Here you are combining the not-equal operator with an empty string using the & sign. Both versions return the same result — use whichever feels more readable to you.
! You can also refer to a cell that contains the <> operator instead of typing it directly. For example, if cell D1 has <> in it, you can write =COUNTIF(B2:B11,D1) and get the same result.
Syntax
=COUNTIF(range, criteria)
  • range The group of cells you want to evaluate. In our example, this is B2:B11 — the score column.
  • criteria The condition to match. Use "<>" to count any cell that is not equal to blank — meaning any cell that has a value in it.

According to Microsoft's official documentation, COUNTIF supports wildcard characters in the criteria argument — use * to match any sequence of characters and ? to match any single character.

COUNTA — The Quickest Way to Count Non-Blank Cells

COUNTA is the most straightforward function for this job. It counts every cell in a range that is not empty — numbers, text, logical values, errors, everything included.

Let's say you have student scores in column B and some cells are blank because students were absent on the day of the test. Here is the formula you need:

=COUNTA(B2:B11)
student-scores.xlsx — Excel C2 fx =COUNTA(B2:B11) A B C 1 Student Score Non-Blank Count 2 Alex 85 7 3 Maria 4 James 90 5 Priya 78 6 Tom 7 Sara 92 8 David 9 Lena 88 10 Chris 74 11 Nina 95

Below are the steps you need to follow:

  1. Click on the cell where you want the result — in this example, that is cell C2.

  2. Type =COUNTA( to start the formula.

  3. Select the range B2:B11 — this is the column where your scores are.

  4. Close the parenthesis and press Enter.

The moment you hit Enter, Excel returns 7 — because three students were absent and their score cells are blank.

The best thing about COUNTA is that you only need to give it a range — no criteria, no conditions. It is the fastest option when you just need a simple count.
! COUNTA will also count a cell that contains just a space character, even though it looks blank on screen. If your data might have hidden spaces, jump to Method 4 where I show you exactly how to handle that.
Syntax
=COUNTA(value1, [value2], ...)
  • value1 The range you want to count. This is required. In our example, this is B2:B11 — the score column.
  • value2 Optional. Add more ranges if you want to count non-blank cells across multiple columns at once. You can add up to 255 ranges.
If your data is in an Excel Table, you can use a structured reference instead of a regular range. For example, =COUNTA(Table1[Score]) counts all non-blank cells in the Score column — and it automatically expands as you add new rows.

COUNTIFS — Count Non-Blank Cells with Multiple Conditions

COUNTIFS is the version you want when you have more than one condition to check at the same time.

Let's say you now have a Gender column added to the same data. You want to count how many female students have a score entered — meaning the Gender column says "Female" AND the Score column is not blank.

Here is the formula:

=COUNTIFS(B2:B11,"Female",C2:C11,"<>")
student-scores.xlsx — Excel D2 fx =COUNTIFS(B2:B11,"Female",C2:C11,"<>") A B C D 1 Student Gender Score Female with Score 2 Alex Male 85 4 3 Maria Female 4 James Male 90 5 Priya Female 78 6 Tom Male 7 Sara Female 92 8 David Male 9 Lena Female 88 10 Chris Male 74 11 Nina Female 95

There are 5 female students in total — but Maria has no score entered. So the formula returns 4, because only Priya, Sara, Lena, and Nina pass both conditions.

Below are the steps you need to follow:

  1. Click on the cell where you want the result — in this example, that is cell D2.

  2. Type =COUNTIFS( to start the formula.

  3. Select B2:B11 as the first range — this is the Gender column.

  4. Add a comma, then type "Female" as the first criteria.

  5. Add another comma, then select C2:C11 as the second range — this is the Score column.

  6. Add a comma, then type "<>" as the second criteria.

  7. Close the parenthesis and press Enter.

Here is how the formula works:

  • First, it goes through column B and checks each cell for the value "Female".
  • Then, for those exact same rows, it checks column C to see if the Score cell is not blank.
  • Only rows that pass both conditions get counted.
The best thing about COUNTIFS is that you can keep adding more range and criteria pairs — up to 127 pairs in a single formula. So you can get very specific without writing multiple formulas.
! Make sure all your ranges in COUNTIFS are exactly the same size. If B2:B11 has 10 rows but C2:C10 only has 9, Excel will return a #VALUE! error.
Syntax
=COUNTIFS(range1, criteria1, [range2, criteria2], ...)
  • range1 The first range to evaluate. In our example, this is B2:B11 — the Gender column.
  • criteria1 The condition for range1. Here we used "Female" to only look at female students.
  • range2 The second range to evaluate. In our example, this is C2:C11 — the Score column.
  • criteria2 The condition for range2. Here we used "<>" to only count rows where the score is not blank.

COUNTIFS — Handle Cells That Only Look Blank

This is a problem I want to point out because it catches a lot of people off guard.

Sometimes a cell looks completely empty, but it actually contains a space character. This happens when someone accidentally pressed the spacebar, or when data was imported from another system.

The problem is that both COUNTA and COUNTIF with <> will count that space-filled cell as non-blank — because technically, it is not empty. So you end up with a wrong count.

Look at this example. We have 7 cells with actual scores, but one cell has a hidden space in it:

student-scores.xlsx — Excel C2 fx =COUNTA(B2:B11) A B C 1 Student Score Non-Blank Count 2 Alex 85 8 3 Maria 92 4 James SPACE 5 Priya 78 6 Tom 7 Sara 88 8 David 9 Lena 95 10 Chris 74 11 Nina 83

Cell B4 looks blank — but the formula bar shows a space inside it. Both COUNTA and COUNTIF count it as non-blank and return 8 instead of the correct 7.

! This is one of the most common data quality issues in Excel. It often happens when data is copy-pasted from a website, exported from a CRM, or filled in manually by different people.

The fix is to use COUNTIFS with a second condition that explicitly excludes cells with a single space. Here is the formula:

=COUNTIFS(B2:B11,"<>",B2:B11,"<> ")
student-scores.xlsx — Excel C2 fx =COUNTIFS(B2:B11,"<>",B2:B11,"<> ") A B C 1 Student Score Non-Blank Count 2 Alex 85 7 3 Maria 92 4 James SPACE 5 Priya 78 6 Tom 7 Sara 88 8 David 9 Lena 95 10 Chris 74 11 Nina 83

Now the formula correctly returns 7 — the space cell in B4 is excluded.

Below are the steps you need to follow:

  1. Click on the cell where you want the result — in this example, that is cell C2.

  2. Type =COUNTIFS( to start the formula.

  3. Select B2:B11 as the first range.

  4. Add a comma, then type "<>" as the first criteria — this excludes truly blank cells.

  5. Add another comma, then select B2:B11 again as the second range.

  6. Add a comma, then type "<> " as the second criteria — note the single space after <>. This excludes cells with only a space in them.

  7. Close the parenthesis and press Enter.

Here is how the two criteria work together:

  • First criteria "<>" — excludes cells that are truly empty.
  • Second criteria "<> " — excludes cells that only contain a space character.

Only cells that pass both checks get counted. That's it.

Make sure there is a single space between the quotes in "<> ". If you leave it empty it becomes identical to the first condition and will not catch hidden spaces.
Syntax
=COUNTIFS(range1, criteria1, range2, criteria2)
  • range1 The range to check for blank cells. In our example, this is B2:B11.
  • criteria1 Use "<>" to exclude truly blank cells.
  • range2 The same range again — B2:B11. You are applying a second condition to the same column.
  • criteria2 Use "<> " with a space after <> to exclude cells that only contain a space character.

SUMPRODUCT — Count Non-Blank Cells with OR Logic

SUMPRODUCT is the method to use when COUNTIFS is not enough — specifically when you need OR logic instead of AND logic.

For a simple non-blank count, here is the SUMPRODUCT formula:

=SUMPRODUCT(--(B2:B11<>""))
student-scores.xlsx — Excel C2 fx =SUMPRODUCT(--(B2:B11<>"")) A B C 1 Student Score Non-Blank Count 2 Alex 85 7 3 Maria 4 James 90 5 Priya 78 6 Tom 7 Sara 92 8 David 9 Lena 88 10 Chris 74 11 Nina 95

Below are the steps you need to follow:

  1. Click on the cell where you want the result — in this example, that is cell C2.

  2. Type =SUMPRODUCT( to start the formula.

  3. Type --( — this is the double negative that converts TRUE and FALSE into 1s and 0s.

  4. Select the range B2:B11 and type <>"" after it — this checks each cell to see if it is not blank.

  5. Close both parentheses and press Enter.

The moment you hit Enter, Excel returns 7 — the same result as COUNTIF and COUNTA.

Now here is where SUMPRODUCT becomes more powerful than the others. If you want to count non-blank scores for Female students using OR logic, you can write it like this:

=SUMPRODUCT((B2:B11="Female")*(C2:C11<>""))
The best thing about SUMPRODUCT is that it works in all versions of Excel — including older versions that do not support dynamic array functions like FILTER.

How This Formula Works

The -- at the start is called a double negative. Here is what happens step by step inside the formula:

  • B2:B11<>"" — checks each cell and returns TRUE if not blank, FALSE if blank.
  • -- — converts TRUE into 1 and FALSE into 0.
  • SUMPRODUCT — adds all the 1s together. That total is your count.
! COUNTIF and COUNTIFS always apply AND logic between conditions. SUMPRODUCT is the only method where you can combine conditions with true OR logic — use the + operator instead of * to switch from AND to OR.
Syntax
=SUMPRODUCT(--(range<>""))
  • range The cells you want to evaluate. In our example, this is B2:B11 — the score column.
  • <>"" The not-blank condition. Returns TRUE if the cell has a value, FALSE if it is empty.
  • -- The double negative. Converts TRUE to 1 and FALSE to 0 so SUMPRODUCT can add them up.

Status Bar — Count Non-Blank Cells Without Any Formula

If you just need a quick count and don't want to write a formula at all, the status bar at the bottom of Excel does this instantly.

All you need to do is select the range — Excel shows you the count straight away.

  1. Select the range of cells you want to check — in this example, B2:B11.

  2. Look at the status bar at the very bottom of your Excel window.

  3. You will see a Count value appear — that is your non-blank cell count.

student-scores.xlsx — Excel B2:B11 fx A B C 1 Student Score 2 Alex 85 3 Maria 4 James 90 5 Priya 78 6 Tom 7 Sara 92 8 David 9 Lena 88 10 Chris 74 11 Nina 95 Count: 7

The moment you select the range, Excel shows Count: 7 in the status bar — no formula needed at all.

! This only works if at least two cells in your selection have values. If only one cell has data, the status bar will not show the Count.

Find & Replace — Another Way to Count Without a Formula

You can also use Find & Replace to count non-blank cells. Here is how:

  1. Select your range first — B2:B11.

  2. Press Ctrl + F to open the Find dialog.

  3. In the Find what field, type an asterisk * — this matches any content.

  4. Click Find All.

Find and Replace Find Replace Find what: * Cell Value $B$2, $B$4... 7 cells found Find All Find Next Close

At the bottom of the results window, Excel tells you exactly how many cells it found — that is your non-blank count.

The asterisk * is a wildcard that matches any text or number. When you use it in Find All, Excel highlights every cell that has content and shows you the total count at the bottom of the results panel.

Excel 365 — Count Non-Blank Cells with FILTER and ROWS

If you are on Excel 365, Excel 2021, or Google Sheets, there is one more way to count non-blank cells using the FILTER function combined with ROWS.

Here is the formula:

=ROWS(FILTER(B2:B11,B2:B11<>""))
student-scores.xlsx — Excel 365 C2 fx =ROWS(FILTER(B2:B11,B2:B11<>"")) A B C 1 Student Score Non-Blank Count 2 Alex 85 7 3 Maria 4 James 90 5 Priya 78 6 Tom 7 Sara 92 8 David 9 Lena 88 10 Chris 74 11 Nina 95

Below are the steps you need to follow:

  1. Click on the cell where you want the result — in this example, that is cell C2.

  2. Type =ROWS(FILTER( to start the formula.

  3. Select the range B2:B11 as the first argument inside FILTER — this is the range you want to filter.

  4. Add a comma, then type B2:B11<>"" as the condition — this tells FILTER to keep only non-blank cells.

  5. Close both parentheses and press Enter.

The moment you hit Enter, Excel returns 7 — the count of all non-blank cells in the range.

How This Formula Works

The two functions work together in a simple sequence:

  • FILTER(B2:B11, B2:B11<>"") — goes through the range and removes every blank cell, returning only the cells that have a value.
  • ROWS() — counts how many rows are left after FILTER removes the blanks. That number is your non-blank count.
! This formula requires a version that supports dynamic arrays — Excel 365, Excel 2021, or Google Sheets. If you are on Excel 2019 or earlier, use COUNTA or COUNTIF instead — they work in all versions.
The best thing about this approach is that it works in both Excel 365 and Google Sheets — and it is very readable. FILTER removes the blanks, ROWS counts what is left.
Syntax
=ROWS(FILTER(range, range<>""))
  • range The cells you want to evaluate. In our example, this is B2:B11 — the score column.
  • range<>"" The condition passed to FILTER. This keeps only cells that are not blank and removes everything else.
  • ROWS() Counts the number of rows returned by FILTER — giving you the total non-blank count.

Frequently Asked Questions

Why does COUNTA count more cells than I expect? +
COUNTA counts any cell that is not completely empty — including cells with a space character or an empty string returned by a formula like ="". If COUNTA is overcounting, switch to the COUNTIFS method with two criteria to exclude those hidden values: =COUNTIFS(B2:B11,"<>",B2:B11,"<> ")
Does COUNTIF count a cell with zero (0) as non-blank? +
Yes. A cell containing 0 is not blank — it has a value. Both COUNTIF and COUNTA will count it. If you want to exclude zeros, add a second criterion: =COUNTIFS(B2:B11,"<>",B2:B11,"<>0")
What is the difference between COUNTIF and COUNTA for counting non-blank cells? +
COUNTA is faster to write — you just give it a range and it counts everything that is not empty. COUNTIF gives you more control because you can combine it with COUNTIFS to add extra conditions. For a simple count, COUNTA is fine. For anything more complex, go with COUNTIFS.
How do I count non-blank cells in Google Sheets? +
The same formulas work in Google Sheets without any changes. =COUNTA(B2:B11) and =COUNTIF(B2:B11,"<>") behave identically to their Excel counterparts. You can use any of the methods from this tutorial directly in Google Sheets.
Which method is the fastest for large datasets? +
For large datasets with 100,000 or more rows, COUNTA and COUNTIF are the fastest options. SUMPRODUCT is more flexible but recalculates the entire array every time the sheet changes, which can slow things down on very large ranges.
Can I count non-blank cells across multiple sheets? +
Yes. You can use a 3D reference with COUNTA to count non-blank cells across multiple sheets at once: =COUNTA(Sheet1:Sheet3!B2:B11) — this spans all sheets from Sheet1 to Sheet3 and counts every non-blank cell in the range B2:B11 on each one.

Wrapping Up

So these are the five ways to count non-blank cells in Excel — COUNTA, COUNTIF, COUNTIFS, SUMPRODUCT, and the no-formula status bar trick. Each one has its place depending on how complex your data is.

Here is a quick way to think about which one to pick:

  • Use COUNTA when you just need a fast, simple count.
  • Use COUNTIF when you want more control over what gets counted.
  • Use COUNTIFS the moment you need a second condition — or when your data has hidden spaces.
  • Use SUMPRODUCT when you need OR logic.
  • Use the status bar when you just need a quick answer and don't want a formula at all.

My personal go-to is COUNTIF for quick jobs and COUNTIFS the moment I need a second condition. SUMPRODUCT is the one I reach for when things get complicated with OR logic.

Which one worked best for you? Let me know in the comments below — and please don't forget to share this post with your friends. I am sure they will find it useful too.

About the Author
Puneet Gogia — Microsoft MVP Excel
Puneet Gogia Microsoft MVP — Excel
Founder, Excel Champs
I've been working with Excel since college and writing about it since 2015. Before starting Excel Champs, I spent years as a data analyst — using Advanced Excel, VBA, and pivot tables in real manufacturing and forecasting environments. Everything on this page has been written and tested by me personally.
3M+
Readers helped
1,000+
Tutorials written
Since 2015
Running Excel Champs