Not Equal To in Excel: How to Use <> in Formulas – LicenceHouse guide

The not equal to operator in Excel is <>, a less-than sign followed by a greater-than sign. =A2<>B2 returns TRUE when the two cells differ and FALSE when they match. Use it inside IF, as in =IF(A2<>"Paid","Chase","OK"), or as a quoted criterion in COUNTIF and SUMIFS, such as "<>Closed".

Operator Meaning Example TRUE when
= Equal to =A2=B2 Values match
<> Not equal to =A2<>B2 Values differ
> Greater than =A2>100 A2 is above 100
< Less than =A2<100 A2 is below 100
>= Greater than or equal to =A2>=100 A2 is 100 or more
<= Less than or equal to =A2<=100 A2 is 100 or less

What is the not equal to sign in Excel?

The not equal to sign in Excel is <>. Excel doesn't accept the mathematical symbol ≠ in formulas, so you type the two characters side by side, with no space between them. Microsoft lists <> alongside the other comparison operators in its guide to calculation operators and precedence in Excel.

Worked example of =A2<>B2 comparing order statuses with Shipped: Pending and Cancelled return TRUE, shipped returns FALSE.

On a UK or US keyboard, both characters sit on the comma and full-stop keys with Shift held down. Every comparison returns a logical value, TRUE or FALSE, which other functions can then act on.

Worked example with order statuses in column A and expected statuses in column B:

Row A: Status B: Expected C: =A2<>B2
2 Shipped Shipped FALSE
3 Pending Shipped TRUE
4 shipped Shipped FALSE
5 Cancelled Shipped TRUE

Row 4 returns FALSE even though the capital letters differ. That's because <> isn't case-sensitive, which is covered below.

How do I write an IF does not equal formula in Excel?

Put the not equal comparison as the first argument of IF: =IF(A2<>"Paid","Send reminder",""). If A2 holds anything other than "Paid", Excel returns "Send reminder"; otherwise it returns an empty string.

Formula =IF(A2<>"Paid","Send reminder","") in parts: the <> test is TRUE for any status except Paid, returning Send reminder.

  1. Click the cell for the result, for example C2.
  2. Type =IF(A2<>"Paid","Send reminder",""). Text values go in double quotes; numbers and cell references don't.
  3. Press Enter and fill the formula down the column.

To compare with a number, drop the quotes: =IF(B2<>0,A2/B2,"n/a") divides only when B2 isn't zero, which avoids the #DIV/0! error. To compare two cells, use =IF(A2<>B2,"Mismatch","Match"). Our full guide to IF then statements in Excel covers the other arguments.

You can also combine several not equal tests. =IF(AND(A2<>"Paid",A2<>"Cancelled"),"Chase","") flags every status that is neither Paid nor Cancelled. Use AND, not OR, here: OR(A2<>"Paid",A2<>"Cancelled") is always TRUE, because any value differs from at least one of the two.

What we commonly see: that OR mistake is the single most common bug in "does not equal" formulas. If a test against several values flags every row, check whether you used OR with <>. Swap it for AND, or reverse the logic with NOT(OR(A2="Paid",A2="Cancelled")).

How do I check if a cell is not blank?

Compare the cell with an empty string: =A2<>"" returns TRUE when A2 has any content. In IF form, =IF(A2<>"",B2*1.2,"") calculates only for rows where A2 has been filled in.

This test treats a formula that returns "" as blank, which is usually what you want. The alternative, =NOT(ISBLANK(A2)), treats that same cell as not blank because it contains a formula. A cell holding a single space also counts as not blank with both methods, so watch for invisible spaces in imported data.

Is not equal to case-sensitive in Excel?

No. ="apple"<>"APPLE" returns FALSE, because Excel treats upper and lower case as the same when comparing text. To run a case-sensitive not equal test, use EXACT and reverse it:

=NOT(EXACT(A2,B2))

EXACT returns TRUE only when the two text values match character for character, including case, so NOT(EXACT()) is a case-sensitive "does not equal". This matters for product codes, passwords and IDs where "ab12" and "AB12" are different items.

Advanced nuance: <> compares data types as well as values. The number 5 and the text "5" are not equal, so =5<>"5" returns TRUE. When figures are imported as text, a comparison that looks obviously FALSE can come back TRUE. Convert the text first with VALUE, or compare A2&"" with B2&"" to force both sides to text.

How do I use not equal to in COUNTIF and SUMIFS?

In COUNTIF, COUNTIFS, SUMIF and SUMIFS, the criterion is text, so put the operator inside quotes: "<>Closed". To compare with a cell, join the operator to the reference with an ampersand: "<>"&E1.

Table of not equal criteria: =COUNTIF(B2:B100,"<>Closed"), "<>" for non-blank cells, "<>"&E1 for a cell, and SUMIFS with "<>North".

Goal Formula
Count rows where status isn't Closed =COUNTIF(B2:B100,"<>Closed")
Count non-blank cells =COUNTIF(B2:B100,"<>")
Count values not equal to E1 =COUNTIF(C2:C100,"<>"&E1)
Sum sales where region isn't North =SUMIFS(D2:D100,A2:A100,"<>North")
Sum where region isn't North and status isn't Closed =SUMIFS(D2:D100,A2:A100,"<>North",B2:B100,"<>Closed")

Microsoft's SUMIFS function page uses the same pattern with "<>Bananas", and its COUNTIF function page shows the "<>"&B4 form for a cell reference. Note that SUMIFS puts the sum range first, unlike SUMIF, where it comes last. Multiple not equal criteria in SUMIFS are combined with AND, which is what you usually want. For more counting patterns, see our guide to the Excel COUNT function.

How do I use less than or equal to in Excel and SUMIFS?

Less than or equal to is <=, typed as a less-than sign followed by an equals sign. In a cell formula, =A2<=100 returns TRUE when A2 is 100 or lower. Inside IF, =IF(A2<=100,"Within budget","Over") labels each row.

In SUMIFS, quote it like any other operator: =SUMIFS(D2:D100,C2:C100,"<=500") adds amounts where column C is 500 or less. For dates, join the operator to a date cell or function, as in =SUMIFS(D2:D100,B2:B100,"<="&TODAY()), which sums everything dated today or earlier. Combine ">=" and "<=" criteria on the same column to sum a range between two dates.

The order of characters matters. Excel recognises <= and >=, but not =< or =>. If you type them the wrong way round, Excel flags a problem with the formula or offers a correction, so always put the equals sign second.

Can I filter or highlight cells that do not equal a value?

Yes. To filter, click the filter arrow on a column heading and choose Text Filters > Does Not Equal (or Number Filters > Does Not Equal for numbers), then enter the value. Our guide to clearing filters in Excel shows how to remove it afterwards.

To highlight, select the range and go to Home > Conditional Formatting > New Rule > Use a formula to determine which cells to format. Enter =$B2<>"Shipped", choose a fill colour and click OK. Every row whose status isn't Shipped is then highlighted, and it updates as the data changes. The <> operator works the same way in Excel 2016, 2019, 2021, 2024, Microsoft 365, Mac and the web.

Frequently asked questions

How do I type the not equal sign in Excel?

Type a less-than sign followed immediately by a greater-than sign: <>. On most keyboards these are Shift plus the comma key and Shift plus the full-stop key. Don't use the ≠ symbol from Insert > Symbol in formulas, because Excel treats it as text rather than an operator. You can still use ≠ in labels and headings.

Why does my not equal formula return TRUE when the values look the same?

The values usually differ in a way you can't see. Common causes are a trailing space, a number stored as text, or a date with a hidden time part. Test with =LEN(A2) and =LEN(B2) to compare lengths, and =ISNUMBER(A2) to check the type. Cleaning the data with TRIM or VALUE usually fixes it.

How do I use does not equal with wildcards?

In COUNTIF, SUMIF and their IFS versions you can combine <> with wildcards. =COUNTIF(A2:A100,"<>*test*") counts cells that don't contain "test" anywhere. Wildcards don't work with <> in a plain cell formula like =A2<>"*test*", which compares against the literal text. Use =ISNUMBER(SEARCH("test",A2))=FALSE there instead.

What is the opposite of not equal to in Excel?

The opposite is the equals sign used as a comparison: =A2=B2 returns TRUE when the cells match. The first equals sign starts the formula and the second compares the values. You can also flip any logical test with NOT, so =NOT(A2<>B2) gives the same result as =A2=B2, though the shorter form is easier to read.

Can I use not equal to with XLOOKUP or FILTER?

Yes, in versions that have those functions. =FILTER(A2:C100,B2:B100<>"Closed") returns every row whose status isn't Closed. FILTER and XLOOKUP are available in Excel 2021, Excel 2024 and Microsoft 365, but not in Excel 2016 or 2019. On older versions, use an AutoFilter with Does Not Equal or a helper column with an IF formula.

Related guides

Links in this guide

Link Type Why it helps
Microsoft Support: Calculation operators and precedence External Official list of comparison operators
Microsoft Support: SUMIFS function External Shows the "<>" criterion in SUMIFS
Microsoft Support: COUNTIF function External Shows "<>" joined to a cell reference
IF then statements in Excel Internal Full IF syntax for not equal tests
Excel COUNT function Internal More counting patterns
Clearing filters in Excel Internal Remove a Does Not Equal filter
INDEX MATCH with multiple criteria Internal Lookups that combine several conditions
Excel, Excel formulas, Excel tips, How-to