Back to Blog

Top 5 Comparison Operators in Google Sheets

Use =, <>, >, <, and combined logical tests inside IF, FILTER, and QUERY conditions.

Aug 7th, 2026SheetFX

Top 5 Comparison Operators in Google Sheets

August 7th, 2026

Almost every useful spreadsheet formula eventually asks a yes/no question: is this equal, different, larger, or smaller? Google Sheets comparison operators — =, <>, >, <, and >= / <= — are the vocabulary for those questions. They power IF, FILTER, COUNTIF, SUMIF, and the WHERE clause of QUERY. This guide shows the five operators in the places you actually use them.

The five operators

| Operator | Meaning | Example (true when…) | | --- | --- | --- | | = | Equal to | A2=10 | | <> | Not equal to | A2<>"Done" | | > | Greater than | A2>100 | | < | Less than | A2<0 | | >= / <= | Greater/less than or equal | A2>=50 |

Comparisons return TRUE or FALSE. Inside IF, those booleans choose a branch; inside FILTER, they keep or drop rows; as numbers, TRUE counts as 1 and FALSE as 0.

1. = — equality

=IF(A2="Paid", "ok", "follow up")

Exact match on text is case-insensitive for = in ordinary formulas ("paid" matches "Paid"). For counts:

=COUNTIF(B:B, "Paid")

With FILTER:

=FILTER(A2:C100, C2:C100="West")

Keeps rows where region is West.

2. <> — not equal

=IF(A2<>"", A2, "missing")
=COUNTIF(A2:A100, "<>Complete")
=FILTER(A2:B50, B2:B50<>"Inactive")

<> is the usual "everything except" operator in Sheets criteria.

3. > and < — strict inequalities

=IF(A2>1000, "large", "normal")
=COUNTIF(D2:D200, ">0")
=FILTER(A2:D100, D2:D100<TODAY())

Rows whose date in column D is before today. Combine with IF for banded labels:

=IF(A2<0, "debt", IF(A2>0, "credit", "zero"))

4. >= and <= — inclusive bounds

Inclusive ranges matter for scores, ages, and thresholds:

=IF(A2>=90, "A", IF(A2>=80, "B", "C or below"))
=COUNTIFS(A2:A100, ">=100", A2:A100, "<=200")
=FILTER(A2:C100, B2:B100>=DATE(2026,1,1), B2:B100<=DATE(2026,12,31))

FILTER accepts multiple conditions as separate arguments (implicit AND).

5. Operators inside QUERY WHERE (and string quoting)

QUERY uses a mini SQL-like language. Comparisons live in the WHERE clause, and string literals must be quoted — usually with single quotes inside the formula string:

=QUERY(A1:D100, "select A, B where C = 'West'", 1)
=QUERY(A1:D100, "select A, sum(D) where D > 100 group by A", 1)
=QUERY(A1:D100, "select * where B <> 'Closed' and D >= 50", 1)

Dates in QUERY often need the date 'yyyy-mm-dd' form:

=QUERY(A1:D100, "select A, B where C >= date '2026-01-01'", 1)

Mixing double quotes carefully: the whole query is a Sheets string ("..."), so text values inside use 'single quotes'. Getting that wrong is the most common QUERY syntax error.

Boolean product for multi-conditions

Outside FILTER/COUNTIFS, you can AND conditions by multiplying booleans (TRUE→1, FALSE→0):

=IF((A2>=50)*(B2="Yes"), "include", "skip")

Both must be true for the product to be 1. OR via addition:

=IF((A2<0)+(B2="Flag")>0, "check", "ok")

Prefer AND / OR when readability matters:

=IF(AND(A2>=50, B2="Yes"), "include", "skip")

For array filters with OR logic, addition or + inside FILTER works:

=FILTER(A2:A100, (B2:B100="Red")+(B2:B100="Blue"))

COUNTIF criteria as strings

COUNTIF / SUMIF often need the operator inside a text criterion:

=COUNTIF(A2:A100, ">=10")
=COUNTIF(A2:A100, "<>"&"")
=COUNTIF(A2:A100, ">"&B1)

Build dynamic thresholds by concatenating the operator with a cell value (">"&B1).

Common mistakes

  • Using ==. Sheets uses a single = for equality (and to start a formula).
  • QUERY string quotes. where C = "West" inside a double-quoted query breaks; use where C = 'West'.
  • Text vs numbers. "100" is not 100. Comparisons can fail silently if a column is text-formatted.
  • = vs EXACT. Ordinary = is case-insensitive for text; use EXACT when case matters.
  • FILTER with AND via * vs separate args. Both work: FILTER(range, cond1, cond2) or FILTER(range, (cond1)*(cond2)).

Quick reference

| Context | Pattern | | --- | --- | | Branching | IF(A2>=10, …, …) | | Keep rows | FILTER(data, col>0) | | Count matches | COUNTIF(range, ">0") | | SQL-like | QUERY(…, "where Col > 0") | | Multi AND | AND(…), FILTER multi-args, or (c1)*(c2) | | Multi OR | OR(…) or (c1)+(c2) |

Going further

For logical composition beyond raw operators, see How to Use Logical Functions in Google Sheets: AND, OR, NOT. For QUERY in depth: Mastering the QUERY Function in Google Sheets. Related functions: IF, FILTER, COUNTIF, QUERY.

Newsletter

Get weekly Sheets tips in your inbox.

Short, practical Google Sheets and Apps Script updates — no noise, just formulas that work.