ExcelReady
CourseFunction guidesBlog
Start freeStart learning for free
ExcelReady

Be Excel-ready before the interview. Hands-on practice in your browser, with instant feedback.

Learn

  • Course
  • Function guides
  • Blog

Product

  • Certificate

Company

  • Editorial policy
  • Contact
  • Terms
  • Privacy

© 2026 ExcelReady. All rights reserved.

  1. Blog
  2. Conditional math
  3. Count Non-Blank Cells With a Condition in Excel

Count Non-Blank Cells With a Condition in Excel

By ExcelReady Team·Updated October 30, 2026·6 min read

The short answer

To count cells that are not blank, use =COUNTIF(C2:C8,"<>"), where "<>" means "not equal to nothing". To add a condition, use COUNTIFS: =COUNTIFS(B2:B8,"Sales",D2:D8,"<>") counts Sales rows whose column D is filled in. Use "" instead of "<>" to count the blank ones. COUNTA also counts non-blank cells, but takes no condition.

Key takeaways

  • "<>" on its own means "not blank": =COUNTIF(range,"<>").
  • COUNTIFS combines "not blank" with other conditions, such as a team or region.
  • "" means blank: =COUNTIFS(B2:B8,"Sales",D2:D8,"") counts Sales rows with nothing in D.
  • A cell with a space, or a formula that returns "", looks empty but may still be counted.
  • COUNT counts only numbers, COUNTA counts anything, and COUNTIF "*" counts only text.
On this page+
  1. How to count cells that are not blank with COUNTIF
  2. How to count non-blank cells with a condition (COUNTIFS)
  3. How to count blank cells with a condition
  4. How to count only numbers or only text
  5. Why do cells that look empty still get counted?
  6. How to build a "filled in" summary for each team
  7. Count non-blank cells with OR conditions, or unique values
  8. Practise it

To count cells that are not blank in Excel, use COUNTIF with the criteria "<>", which means "not equal to empty". To count non-blank cells only in rows that meet another condition, such as one team or region, use COUNTIFS. This guide is for anyone tracking forms, applicants or orders who needs to know "how many have been filled in?", and it covers the cells that look blank but aren't.

How to count cells that are not blank with COUNTIF#

=COUNTIF(range,"<>") counts every cell in the range that has something in it. Here is a list of job applicants, with some details still missing:

ABCD
1ApplicantTeamEmailTest score
2Ana LopezSalesana@mail.com78
3Ben OkaforFinance85
4Chloe KimSaleschloe@mail.com
5Dev PatelSalesdev@mail.com64
6Eva NovakFinanceeva@mail.com
7Farid HaddadSalesabsent
8Grace LinFinancegrace@mail.com91

To count the applicants with an email address:

Excel formula
=COUNTIF(C2:C8,"<>")

The result is 5. In COUNTIF, <> means "not equal to". With nothing after it, the test is "not equal to empty", in other words "not blank". The quotes are required. The COUNTIF guide covers the other operators, such as ">=8".

COUNTA gives the same answer here: =COUNTA(C2:C8) also returns 5. The difference is that COUNTA can't take a condition, and the COUNTIF version can grow into COUNTIFS.

How to count non-blank cells with a condition (COUNTIFS)#

To count filled cells only in certain rows, add the "not blank" test as one pair in COUNTIFS. COUNTIFS takes pairs of range and criteria, and counts a row only if every pair matches.

How many Sales applicants have a test score entered?

Excel formula
=COUNTIFS(B2:B8,"Sales",D2:D8,"<>")

The result is 3: Ana (78), Dev (64) and Farid ("absent"). Chloe is in Sales but her score is blank, so she isn't counted.

You can add more pairs. =COUNTIFS(B2:B8,"Sales",C2:C8,"<>",D2:D8,"<>") counts Sales applicants with both an email and a score; the result is 2 (Ana and Dev). The COUNTIF function guide has the full syntax for criteria.

How to count blank cells with a condition#

Use "" (two double quotes with nothing between them) to mean "blank". How many Sales applicants still need a test score?

Excel formula
=COUNTIFS(B2:B8,"Sales",D2:D8,"")

The result is 1 (Chloe). Without a condition, COUNTBLANK does the same: =COUNTBLANK(D2:D8) returns 2. A useful check is that "blank" plus "not blank" equals the total: 1 Sales blank + 3 Sales filled = 4 Sales applicants, which matches =COUNTIF(B2:B8,"Sales").

Our comparison of COUNT vs COUNTA vs COUNTBLANK goes deeper on the three counting functions.

How to count only numbers or only text#

"Not blank" counts everything, including text such as "absent". Sometimes you only want real numbers, or only text.

What to countFormulaResult on D2:D8
Anything (not blank)=COUNTIF(D2:D8,"<>")5
Numbers only=COUNT(D2:D8)4
Text only=COUNTIF(D2:D8,"*")1
Numbers only, Sales team=COUNTIFS(B2:B8,"Sales",D2:D8,">=0")2

The asterisk * is a wildcard that matches any text, so "*" counts text cells and skips numbers. The ">=0" criterion only matches numbers, which is a simple way to say "has a numeric score". Use ">-1E+307" instead if negative numbers are possible. The Excel count functions guide summarises all of these.

Why do cells that look empty still get counted?#

A cell can look blank but hold something Excel counts. The usual causes are:

  1. A space. Someone typed a space, or the data was imported with one. COUNTA and "<>" both count it. Click the cell and check the formula bar.
  2. A formula that returns empty text, such as =IF(B2="","",B2*2). The cell shows nothing, but COUNTA counts it because it holds a formula. COUNTBLANK, on the other hand, counts it as blank.
  3. An apostrophe on its own ('), which makes the cell hold empty text.

To count only cells with visible content, check the length of each cell:

Excel formula
=SUMPRODUCT(--(LEN(D2:D8)>0))

LEN gives the number of characters, so a formula returning "" has length 0 and isn't counted. To ignore cells that hold only spaces too, use =SUMPRODUCT(--(TRIM(D2:D8)<>"")). To fix the data itself, select the column, use Find & Replace (Ctrl+H on Windows, ⌃H on Mac) to replace a single space with nothing, but check first that real values don't contain spaces you need.

How to build a "filled in" summary for each team#

In reports, you usually want the count for every team, not just one. Put the team names in a column, say F2:F3 (Sales, Finance), and point COUNTIFS at those cells instead of typing the name:

Excel formula
=COUNTIFS($B$2:$B$8,F2,$D$2:$D$8,"<>")

Lock the ranges with dollar signs, leave F2 relative, and fill down. Sales shows 3 and Finance shows 2. To show progress as a share, divide by the team size: =COUNTIFS($B$2:$B$8,F2,$D$2:$D$8,"<>")/COUNTIF($B$2:$B$8,F2) returns 0.75 for Sales; format it as a percentage to read 75%. This is the kind of "how complete is our data?" check that admin and HR tests like to ask for.

Count non-blank cells with OR conditions, or unique values#

COUNTIFS joins its conditions with AND. For OR, such as "Sales or Finance, with a score", add two COUNTIFS together:

Excel formula
=COUNTIFS(B2:B8,"Sales",D2:D8,"<>")+COUNTIFS(B2:B8,"Finance",D2:D8,"<>")

This returns 5. The same pattern works for sums; see SUMIFS with OR logic. If you need the number of different values rather than filled cells, such as distinct customers, see how to count unique values in Excel.

Practise it#

Try the live exercise on this page to count the Sales applicants who have a score. Then practise COUNTIF in a live spreadsheet, including the <> operator, and work through the COUNT, COUNTA and COUNTBLANK lesson to see exactly which cells each function counts.

Try it yourself

This is a live spreadsheet. Type the formula in the green cell and press Enter.

Count how many Sales applicants have something in the Test score column. In G2, use COUNTIFS: Team (B2:B8) must be "Sales" and Test score (D2:D8) must be not blank ("<>").

fx
ABCDEFGH
1
Applicant
Team
Email
Test score
Sales with a score
2
Ana Lopez
Sales
ana@mail.com
78
3
Ben Okafor
Finance
85
4
Chloe Kim
Sales
chloe@mail.com
5
Dev Patel
Sales
dev@mail.com
64
6
Eva Novak
Finance
eva@mail.com
7
Farid Haddad
Sales
absent
8
Grace Lin
Finance
grace@mail.com
91
9
10
11

Tip: Two pairs: B2:B8 with "Sales", then D2:D8 with "<>".

Practise this in a lesson

LessonCOUNTIFCount the cells that match a condition, from exact words to number checks like ">=8".LessonCOUNT, COUNTA and COUNTBLANKCount numbers, filled cells and empty cells, a quick way to audit data.Function guideCOUNTIFCount cells that match one condition with COUNTIF: text, numbers, wildcards and cell references. Real examples and a live exercise.Function guideCOUNTAUse COUNTA to count non-empty cells in Excel. Learn how it differs from COUNT, what it secretly counts, and try a live exercise.

Frequently asked questions

What does "<>" mean in COUNTIF?

+

"<>" means "not equal to". With nothing after it, it means "not equal to empty", so =COUNTIF(A2:A10,"<>") counts every cell that has something in it.

How do I count non-blank cells with a condition?

+

Use COUNTIFS with "<>" for the column that must be filled: =COUNTIFS(B2:B8,"Sales",D2:D8,"<>") counts rows where B is Sales and D is not blank.

What is the difference between COUNTA and COUNTIF "<>"?

+

On normal data they give the same result. COUNTIF can be combined with other conditions through COUNTIFS, while COUNTA just counts every non-empty cell in the range.

Why does COUNTA count cells that look empty?

+

The cell holds something invisible: a space, or a formula that returns empty text (""). Click the cell and look at the formula bar to find out.

How do I count only cells with numbers, not text?

+

Use COUNT, which counts numbers only. With a condition, use a numeric criterion such as =COUNTIFS(B2:B8,"Sales",D2:D8,">=0").

Sources

  • COUNTIF function - Microsoft Support
  • COUNTIFS function - Microsoft Support
  • COUNTA function - Microsoft Support

Written and checked by the ExcelReady Team. First published October 30, 2026. The practice exercise runs in the same formula engine as our lessons. Found a mistake? Read our editorial policy or email hello@excelready.app.

On this page

  1. How to count cells that are not blank with COUNTIF
  2. How to count non-blank cells with a condition (COUNTIFS)
  3. How to count blank cells with a condition
  4. How to count only numbers or only text
  5. Why do cells that look empty still get counted?
  6. How to build a "filled in" summary for each team
  7. Count non-blank cells with OR conditions, or unique values
  8. Practise it

Keep reading

Conditional math· 7 min read

SUMIFS With OR Logic in Excel

SUMIFS joins every condition with AND, so for OR you combine several sums. Add two SUMIFS: =SUMIFS(E2:E9,A2:A9,"North")+SUMIFS(E2:E9,A2:A9,"East"), or use an array constant: =SUM(SUMIFS(E2:E9,A2:A9,{"North","East"})). When the OR spans two different columns, use SUMPRODUCT so rows that match both aren't counted twice.

Conditional math· 6 min read

How to Count Unique Values in Excel

In Excel 2021 and Microsoft 365, count unique values with =COUNTA(UNIQUE(B2:B11)): UNIQUE lists each different value once and COUNTA counts the list. Add a condition with FILTER, as in =COUNTA(UNIQUE(FILTER(B2:B11,C2:C11="East"))). In older Excel, use =SUMPRODUCT(1/COUNTIF(B2:B11,B2:B11)) instead.

Math· 6 min read

COUNT, COUNTA and COUNTBLANK: Counting Cells in Excel

The Excel COUNT function counts cells that contain numbers, such as =COUNT(B2:B7). COUNTA counts every cell that isn't empty, numbers and text alike, and COUNTBLANK counts the empty cells. Use =COUNTA(B2:B7)-COUNT(B2:B7) to find values that are filled in but aren't real numbers.

Don't just read about Excel. Do it.

Practise real formulas in a live spreadsheet with instant feedback. The first lessons are free, with no download.

Start learning for free