ExcelReady
CourseMock testsFunction guidesBlog
Start freeStart learning for free
ExcelReady

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

Learn

  • Course
  • Mock tests
  • Function guides
  • Blog

Test prep

  • Excel level test
  • Excel test practice
  • Free screening quiz
  • Certificate

Company

  • About
  • Editorial policy
  • Contact
  • Terms
  • Privacy

© 2026 ExcelReady. All rights reserved.

  1. Blog
  2. Conditional math
  3. COUNTIF Not Equal To: Count Cells That Don't Match

COUNTIF Not Equal To: Count Cells That Don't Match

By ExcelReady Team·Updated November 2, 2026·7 min read

The short answer

To count cells that are not equal to something, put <> in front of the value inside quotes: =COUNTIF(C2:C9,"<>Shipped"). To use a cell instead, join it with &: =COUNTIF(C2:C9,"<>"&F1). Blank cells count as "not equal", so add a second condition with COUNTIFS, "<>", if you want to skip them.

Key takeaways

  • Not equal to in Excel is <>, written inside the quotes: "<>Shipped".
  • For a cell value, keep <> in quotes and join the cell with &: "<>"&F1.
  • "<>Shipped" also counts blank cells. Add a "<>" condition in COUNTIFS to leave them out.
  • To exclude two values, use COUNTIFS with the same range twice: one "<>" condition for each value.
On this page+
  1. How to write a COUNTIF not equal to formula
  2. Why <> means not equal to
  3. The blank-cell trap
  4. How to count cells not equal to a cell value
  5. How to exclude two or more values
  6. Not equal to a number, zero or partial text
  7. Check your result: total minus matches
  8. Practise it

To use COUNTIF for "not equal to", put <> in front of the value inside the quotes: =COUNTIF(C2:C9,"<>Shipped") counts every cell that is anything other than Shipped. The same idea works with a cell reference, with numbers and with several values to exclude. This guide is for anyone who needs to count "everything except" in a report or a job test, and it points out the blank-cell trap that catches most people.

How to write a COUNTIF not equal to formula#

Write the not-equal sign, <>, directly before the value, and put both inside one pair of double quotes. The pattern is:

Excel formula
=COUNTIF(range,"<>value")

All the examples use this order list in A1:D9. Order O-105 has no status yet, so C6 is empty:

ABCD
1OrderRegionStatusAmount
2O-101NorthShipped120
3O-102SouthPending80
4O-103EastShipped200
5O-104NorthCancelled50
6O-105West95
7O-106SouthShipped150
8O-107EastPending60
9O-108NorthShipped175

To count the orders that are not from the North region:

Excel formula
=COUNTIF(B2:B9,"<>North")

The result is 5: two South, two East and one West. COUNTIF is not case-sensitive, so "north" in a cell would also be left out. The COUNTIF function guide has the full syntax.

Why <> means not equal to#

In Excel, <> is the not equal to operator: "less than or greater than", which means "different from". It is one of six comparison operators:

OperatorMeaningCOUNTIF criteria
=Equal to"Shipped" or "=Shipped"
<>Not equal to"<>Shipped"
>Greater than">100"
<Less than"<100"
>=Greater than or equal to">=100"
<=Less than or equal to"<=100"

The != sign from programming languages does not work in Excel, and neither does =!. The guide to Excel comparison operators shows each one in formulas, and the lesson on TRUE, FALSE and comparisons lets you try them.

The blank-cell trap#

A blank cell is "not equal to Shipped", so COUNTIF counts it. On the order list:

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

The result is 4: two Pending, one Cancelled and the empty status of O-105. That is often what you want, because an order with no status is certainly not shipped. But if you only want to count orders with some other status, leave the blanks out with COUNTIFS and a second "not blank" condition:

Excel formula
=COUNTIFS(C2:C9,"<>Shipped",C2:C9,"<>")

The result is now 3. On its own, "<>" means "not equal to nothing", which is how Excel says "not blank". The guide to COUNTIF not blank covers that criteria in more detail.

How to count cells not equal to a cell value#

To compare against a value in another cell, keep <> in quotes and join the cell with the & sign. If F1 holds the word Pending:

Excel formula
=COUNTIF(C2:C9,"<>"&F1)

The result is 6: four Shipped, one Cancelled and the blank. Change F1 to Shipped and the answer updates to 4.

Two versions of this formula look right but fail:

  • =COUNTIF(C2:C9,"<>F1") counts cells that are not the text "F1". Every cell qualifies, so you get 8.
  • =COUNTIF(C2:C9,<>F1) is not a valid formula. Excel shows an error message before you can even press Enter.

If you fill the formula down a summary table, lock the range with $: =COUNTIF($C$2:$C$9,"<>"&F1).

How to exclude two or more values#

COUNTIF takes only one condition, so to exclude two values use COUNTIFS with the same range twice. To count orders that are neither Shipped nor Cancelled:

Excel formula
=COUNTIFS(C2:C9,"<>Shipped",C2:C9,"<>Cancelled")

The result is 3: the two Pending orders and the blank one. COUNTIFS uses AND logic, so a cell is counted only when it passes every condition. Add a third pair to exclude a third value.

You can also mix "not equal to" with other conditions. North orders that are not Shipped:

Excel formula
=COUNTIFS(B2:B9,"North",C2:C9,"<>Shipped")

That returns 1 (O-104, Cancelled). The COUNTIFS function guide and the COUNTIFS and SUMIFS lesson cover multi-condition counts step by step.

A common slip is to write two COUNTIFs and subtract or add them. =COUNTIF(C2:C9,"<>Shipped")+COUNTIF(C2:C9,"<>Cancelled") returns 4 + 7 = 11, more than the number of orders, because each COUNTIF counts the other's rows.

Not equal to a number, zero or partial text#

Numbers work the same way, with or without a cell:

QuestionFormulaResult
Amount is not 50=COUNTIF(D2:D9,"<>50")7
Amount is not 0=COUNTIF(D2:D9,"<>0")8
Status does not contain "pend"=COUNTIF(C2:C9,"<>*pend*")6

The last one uses the * wildcard, which stands for any characters. "<>*pend*" excludes every cell that contains "pend" anywhere. Like the other examples, it still counts the blank status.

COUNTIF ignores capitals, so "<>shipped" also leaves out "Shipped" and "SHIPPED". If case matters, for example with product codes, use EXACT inside SUMPRODUCT instead:

Excel formula
=SUMPRODUCT(--NOT(EXACT(C2:C9,"Shipped")))

EXACT returns TRUE only for a perfect match, including capitals. NOT flips each result, and the double minus turns TRUE and FALSE into 1 and 0 for SUMPRODUCT to add. On this data the result is 4, the same as before, because every status is typed the same way.

The same <> criteria work in SUMIF and SUMIFS when you want a total instead of a count. See SUMIF not equal to and SUMIFS not equal to.

Check your result: total minus matches#

A quick way to check any "not equal to" count is to take the total number of rows and subtract the matches:

Excel formula
=ROWS(C2:C9)-COUNTIF(C2:C9,"Shipped")

This gives 8 − 4 = 4, the same as "<>Shipped". If your two answers differ, look for extra spaces in the data: "Shipped " with a trailing space is not equal to "Shipped", so it is counted when you don't expect it. The COUNTIF guide lists the other reasons counts go wrong.

Practise it#

Try the exercise on this page: it counts the orders that are not from the North region. Then practise COUNTIF in a live spreadsheet, where you type each criteria and get instant feedback. When you're ready for two conditions, move on to the COUNTIFS and SUMIFS lesson.

Try it yourself

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

How many orders are not from the North region? Click G2 and use COUNTIF with "<>North" on the Region column (B2:B9), then press Enter.

fx
ABCDEFGH
1
Order
Region
Status
Amount
2
O-101
North
Shipped
120
Not North
3
O-102
South
Pending
80
4
O-103
East
Shipped
200
5
O-104
North
Cancelled
50
6
O-105
West
95
7
O-106
South
Shipped
150
8
O-107
East
Pending
60
9
O-108
North
Shipped
175
10
11
12

Tip: The range is B2:B9. The criteria is <> and North together inside one pair of double quotes.

Practise this in a lesson

LessonCOUNTIFCount the cells that match a condition, from exact words to number checks like ">=8".LessonTRUE, FALSE and comparisonsAsk Excel yes-or-no questions with =, <>, >, <, >= and <=, and get TRUE or FALSE back. The building block of every IF.LessonCOUNTIFS and SUMIFSCount and sum with several conditions at once, and learn why SUMIFS puts the sum range first.Function guideCOUNTIFCount cells that match one condition with COUNTIF: text, numbers, wildcards and cell references. Real examples and a live exercise.Function guideCOUNTIFSCount rows that meet several conditions with COUNTIFS. Examples for text, number ranges and between-values, plus a live exercise.

Frequently asked questions

How do I use COUNTIF for not equal to?

+

Put the not-equal sign <> before the value, all inside double quotes: =COUNTIF(C2:C9,"<>Shipped"). It counts every cell in the range that is anything other than Shipped, including blank cells.

How do I count cells not equal to multiple values?

+

Use COUNTIFS and repeat the range, once for each value: =COUNTIFS(C2:C9,"<>Shipped",C2:C9,"<>Cancelled"). Every condition must be true, so a cell is counted only if it is neither value.

How do I count cells not equal to another cell?

+

Join the operator to the cell with an ampersand: =COUNTIF(C2:C9,"<>"&F1). Don't write "<>F1", because inside quotes F1 is just two letters, not a cell reference.

Does COUNTIF not equal to count blank cells?

+

Yes. A blank cell is not equal to Shipped, so =COUNTIF(C2:C9,"<>Shipped") includes it. To skip blanks, use =COUNTIFS(C2:C9,"<>Shipped",C2:C9,"<>").

Is COUNTIF not equal to case-sensitive?

+

No. "<>shipped" treats Shipped, SHIPPED and shipped as the same word, so none of them are counted. For a case-sensitive count, use SUMPRODUCT with EXACT.

Sources

  • COUNTIF function - Microsoft Support
  • COUNTIFS function - Microsoft Support
  • Calculation operators and precedence in Excel - Microsoft Support

Written and checked by the ExcelReady Team. First published November 2, 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 write a COUNTIF not equal to formula
  2. Why <> means not equal to
  3. The blank-cell trap
  4. How to count cells not equal to a cell value
  5. How to exclude two or more values
  6. Not equal to a number, zero or partial text
  7. Check your result: total minus matches
  8. Practise it

Keep reading

Conditional math· 6 min read

How to Use COUNTIF in Excel (With Criteria Examples)

COUNTIF counts the cells in a range that meet one condition. Write =COUNTIF(range, criteria), for example =COUNTIF(D2:D9,"Open") to count open tickets. Put text and comparisons in double quotes, like ">=8" or "<>Low". Numbers and cell references go in without quotes. For two or more conditions, use COUNTIFS.

Conditional math· 6 min read

SUMIF Not Equal To: Exclude a Value From a Total

To sum everything except one value, use the not-equal-to operator <> inside quotes: =SUMIF(A2:A8,"<>North",C2:C8) adds the sales of every region except North. For a value in a cell, write "<>"&E1. To exclude two or more values, use SUMIFS with one "<>" condition for each value.

Conditional math· 6 min read

SUMIFS Not Equal To: Exclude Values From a Total

In SUMIFS, not equal to is written "<>" followed by the value, inside double quotes. =SUMIFS(D2:D8,C2:C8,"<>Cancelled") adds every amount except cancelled orders. To exclude two values, repeat the range with a second "<>" condition. To use a cell, join it with &, as in "<>"&G2.

More on conditional math

  • How to Calculate a Percentage With COUNTIF in Excel
  • COUNTIFS With a Date Range in Excel
  • COUNTIFS and SUMIFS: Multiple Conditions in Excel
  • MAXIFS and MINIFS: Highest and Lowest With Conditions
  • MINIFS in Excel: Find the Smallest Value That Matches
  • How to Sum by Category in Excel
All conditional math articles →

Don't just read about Excel. Do it.

Practise real formulas in a live spreadsheet with instant feedback, right in your browser. Nothing to download.

Start learning for free