To count cells that match a specific value in Google Sheets, use the COUNTIF function with the syntax =COUNTIF(range, criterion). For example, =COUNTIF(A2:A100, "Paid") counts every cell in that range containing exactly "Paid". This works for exact matches, partial matches with wildcards, numbers, and even other cell references. You need a Google Sheets document with the data already entered; no special setup or add-ons are required.

What You'll Need

  • A Google Sheets document with your data in a column or row
  • The specific value you want to count (text, number, or a reference to another cell)
  • Basic familiarity with typing formulas into a cell (starting with an equals sign)

Step-by-Step

  1. Open your Google Sheets document and locate the column or row containing the values you want to count. For this guide, assume your data is in column A, rows 2 through 100.
  2. Click an empty cell where you want the count to appear. This can be on the same sheet, a different sheet, or even a different file (if you use IMPORTRANGE, but that is more advanced). For now, pick a cell below or beside your data, like B2.
  3. Type the equals sign to begin the formula. Every function in Google Sheets starts with =.
  4. Type COUNTIF followed by an opening parenthesis. The formula bar will show a small hint about the arguments: COUNTIF(range, criterion).
  5. Enter the range as the first argument. This is the set of cells you want to examine. Type it directly, like A2:A100, or click and drag to select the cells. If your data is in a row, use something like B2:Z2. The range can include blank cells; they simply won't match your criterion.
  6. Type a comma to separate the arguments.
  7. Enter the criterion as the second argument. This is the value you are matching. There are several ways to do this:
    • Exact text: Put the text in double quotes, e.g., "Paid". This is case-insensitive, so "paid" and "PAID" both count.
    • Exact number: Type the number directly, e.g., 42. Do not use quotes around numbers.
    • Cell reference: Type a cell address, e.g., D1, where D1 contains the value you want to match. This makes the formula dynamic; if you change D1, the count updates automatically.
    • Partial match (contains): Use asterisks as wildcards. "*Paid*" counts any cell containing the word "Paid" anywhere. "Paid*" counts cells starting with "Paid". "*Paid" counts cells ending with "Paid".
    • Comparison operators: Combine with a number or date, e.g., ">50" or "<="&TODAY(). Note the quotes around the operator and the ampersand to join it with a function.
  8. Close the parenthesis and press Enter. The cell will display the count. For example, =COUNTIF(A2:A100, "Paid") returns the number of cells in A2:A100 that exactly equal "Paid".
  9. Check the result by manually scanning a few rows. If the number seems off, verify your range and criterion spelling. Remember that leading or trailing spaces in your data will break exact matches; use =TRIM() on the data first if needed.

Common Mistakes

  • Forgetting quotes around text: =COUNTIF(A2:A100, Paid) will cause a #NAME? error because Sheets reads Paid as a named range, not text. Always use double quotes for text strings.
  • Using quotes around numbers: =COUNTIF(A2:A100, "42") treats 42 as text. If your cells contain numbers, this will return 0. Use =COUNTIF(A2:A100, 42) instead.
  • Mismatched range sizes: If you use COUNTIF(A2:A100, D1) and D1 is blank, the count will be 0. If D1 contains text, it must match exactly, including case (though case is ignored) and spacing.
  • Counting blank cells unintentionally: =COUNTIF(A2:A100, "") counts blank cells. If you want to count non-blank cells, use =COUNTA(A2:A100) instead.
  • Using wildcards when you want literal asterisks: If your data contains actual asterisk characters and you want to count them, you must escape them with a tilde, like "~*". Otherwise, Sheets treats * as a wildcard.

Tips

  • Use a cell reference for the criterion to make your sheet interactive. Put the value you are counting in a cell (e.g., D1) and use =COUNTIF(A2:A100, D1). Then change D1 to see the count update instantly.
  • Combine COUNTIF with other functions. For example, =SUM(COUNTIF(A2:A100, {"Red", "Blue"})) counts cells that are either Red or Blue. The curly braces create an array of criteria.
  • Use COUNTIFS for multiple conditions. If you need to match more than one criterion, like counting "Paid" in column A and "January" in column B, use =COUNTIFS(A2:A100, "Paid", B2:B100, "January"). The syntax is the same but with paired range/criterion arguments.
  • Check for hidden characters. Data imported from other systems often has non-breaking spaces or line breaks. Use =CLEAN(A2) and =TRIM(A2) in a helper column to normalize data before counting.
  • Use conditional formatting to verify. Select your data range, go to Format > Conditional formatting, and set a custom formula like =A2="Paid" to highlight matching cells. This visually confirms what your COUNTIF is counting.

Troubleshooting

If the formula returns 0 but you know matches exist: Check for extra spaces in your data. Select a cell that should match, look in the formula bar, and see if there is a trailing space. Use =TRIM(A2) to clean it. Also check that your criterion uses the correct case (though COUNTIF is case-insensitive, it is not accent-insensitive; "café" and "cafe" are different).

If the formula returns #NAME? or #VALUE!: #NAME? usually means you forgot quotes around text. #VALUE! often means your criterion is a formula that evaluates to an error, or you used a comparison operator incorrectly, like ">50" without quotes. Ensure the operator is inside the quotes.

If the count is too high: You might be using wildcards unintentionally. For example, "Paid" matches only "Paid", but "*Paid*" matches "Paid", "Unpaid", "Prepaid", and anything containing "Paid". Review your criterion for asterisks.

If the count does not update when you change data: Google Sheets recalculates automatically, but if you have manual calculation enabled (File > Settings > Calculation), change it to "On change and every minute". Also ensure you are not editing the same cell that contains the formula.

If the formula works but shows a different count than expected: Check if your range includes merged cells. Merged cells only count the top-left value. Also check if there are duplicate rows you forgot about. Sort your data to see the actual values.

Frequently Asked Questions

Is COUNTIF case-sensitive?

No, COUNTIF ignores case. "PAID", "paid", and "Paid" all count the same. If you need case-sensitive counting, use =ARRAYFORMULA(SUM(--EXACT(A2:A100, "Paid"))).

Can I count cells that contain a word anywhere, not just exact matches?

Yes, use wildcards. =COUNTIF(A2:A100, "*word*") counts any cell containing "word" anywhere. The asterisk represents any number of characters.

How do I count cells that do not match a value?

Use the not-equal operator: =COUNTIF(A2:A100, "<>Paid"). This counts all cells that are not exactly "Paid", including blanks. To exclude blanks too, use =COUNTIFS(A2:A100, "<>Paid", A2:A100, "<>").

Can COUNTIF work across multiple sheets?

Yes, reference the sheet name in the range: =COUNTIF(Sheet2!A2:A100, "Paid"). For multiple sheets, you would need multiple COUNTIF functions added together, or use a query.

Why does my formula count blank cells?

If your criterion is an empty string "", it counts blanks. If you are using "<>Paid", it counts blanks because blank is not equal to "Paid". To exclude blanks, add a second condition with COUNTIFS as shown above.

How do I count based on a cell value in another column?

Use COUNTIFS for multiple conditions. For example, to count rows where column A is "Paid" and column B is "January": =COUNTIFS(A2:A100, "Paid", B2:B100, "January"). This counts only rows where both conditions are true.