Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

Counting Unique Entries in Excel: Step-by-Step Guide

· 5 min read · Home Tech

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

To count unique entries in an Excel table, the most reliable modern method is the UNIQUE and COUNTA combination: enter =COUNTA(UNIQUE(range)) in an empty cell, replacing range with your column (for example A2:A100). This returns the number of distinct values, ignoring blanks. If you are on an older Excel version without UNIQUE, use =SUMPRODUCT(1/COUNTIF(range,range)) instead, which works in Excel 2007 and later. For a quick visual check, you can also use Data > Remove Duplicates on a copy of the column and see how many rows remain. The steps below cover all three approaches, plus how to handle blanks, case sensitivity and mixed data types.

What You'll Need

  • Excel 2016 or later for the UNIQUE function (Microsoft 365 and Excel 2021+ recommended). The SUMPRODUCT method works in Excel 2007 and later.
  • A table or column of data with a header row, ideally formatted as an Excel Table (select the range and press Ctrl+T) so ranges expand automatically.
  • An empty cell outside your data range to hold the formula.
  • Basic familiarity with entering formulas and pressing Enter.

Step-by-Step

Method 1: UNIQUE + COUNTA (Excel 365, Excel 2021 and later)

  1. Click an empty cell, for example E2, where you want the count to appear.
  2. Type =COUNTA(UNIQUE( and then select your data range, such as A2:A100. Do not include the header row.
  3. Close the parentheses so the formula reads =COUNTA(UNIQUE(A2:A100)) and press Enter.
  4. The cell shows the number of distinct values in that range. Blanks are ignored automatically by UNIQUE, so an empty cell in the source does not inflate the count.
  5. If you want the list of unique values as well, enter =UNIQUE(A2:A100) in a separate cell. It spills down automatically. You can then reference that spill range with COUNTA, for example =COUNTA(E2#).

Method 2: SUMPRODUCT + COUNTIF (older Excel versions)

  1. Click an empty cell.
  2. Enter =SUMPRODUCT(1/COUNTIF(A2:A100,A2:A100)) and press Enter.
  3. This counts each value once regardless of how many times it appears. It works in Excel 2007 through 2019 and in Excel 365 as a fallback.
  4. If your range contains blank cells, the formula returns a #DIV/0! error because COUNTIF returns zero for blanks. Use =SUMPRODUCT((A2:A100<>"")/COUNTIF(A2:A100,A2:A100&"")) instead, which ignores blanks.

Method 3: Remove Duplicates on a copy

  1. Copy your column to a new sheet or an empty area so you do not alter the original data.
  2. Select the copied range, including the header.
  3. Go to Data > Remove Duplicates. Confirm the column is ticked and click OK.
  4. Excel reports how many duplicate values were removed and how many unique values remain. The remaining row count is your unique count.
  5. Delete the copy when you are done.

Counting unique combinations of two columns

  1. In Excel 365 or 2021, use =COUNTA(UNIQUE(A2:A100&"|"&B2:B100)). The pipe character separates the two values so that "AB" + "C" is not confused with "A" + "BC".
  2. In older Excel, use =SUMPRODUCT((A2:A100<>"")/COUNTIFS(A2:A100,A2:A100&"",B2:B100,B2:B100&"")).

Common Mistakes

  • Including the header row. The header counts as a unique value. Start the range at row 2.
  • Leaving blanks in the range. UNIQUE ignores blanks, but SUMPRODUCT does not. Use the blank-safe version shown above.
  • Forgetting that text and numbers are different. The text "123" and the number 123 count as two unique entries. Convert one format to the other with Data > Text to Columns or by multiplying by 1.
  • Assuming case sensitivity. UNIQUE and COUNTIF treat "Apple" and "apple" as the same value. If case matters, use =COUNTA(UNIQUE(EXACT(range,range))) or a helper column with =EXACT(A2,A2).
  • Trailing spaces. "Widget " and "Widget" count as two entries. Clean with =TRIM(A2) in a helper column first.
  • Using whole-column references carelessly. A:A works but can slow large workbooks. Use a bounded range or an Excel Table reference like .

Tips

  • Format your source as an Excel Table (Ctrl+T) so formulas expand when you add rows. Reference the table column, for example =COUNTA(UNIQUE(Table1[Customer])).
  • Use =COUNTA(UNIQUE(FILTER(A2:A100,A2:A100<>""))) to count unique non-blank values explicitly.
  • To count unique values that meet a condition, combine FILTER with UNIQUE: =COUNTA(UNIQUE(FILTER(A2:A100,B2:B100="Open"))).
  • Press Ctrl+Shift+Enter only if you are on an older Excel version and the formula returns a single value unexpectedly. In Excel 365, Enter is enough.
  • Keep the helper formula on a separate sheet or in a clearly labelled cell so it does not get overwritten.

Troubleshooting

  • #NAME? error: Your Excel version does not recognise UNIQUE. Use the SUMPRODUCT method or update to Microsoft 365 or Excel 2021.
  • #DIV/0! error: Your range contains blanks. Use the blank-safe SUMPRODUCT formula or switch to UNIQUE.
  • #SPILL! error: The UNIQUE formula cannot spill because cells below or beside it are not empty. Clear the area or move the formula.
  • Count is higher than expected: Check for trailing spaces, mixed text and number formats, or hidden rows. Use =TRIM() and =VALUE() in helper columns, then recount.
  • Count is lower than expected: Case differences or duplicate-looking entries with different formatting are being merged. Confirm with =EXACT() comparisons.
  • Formula does not update: Check that calculation is set to Automatic under Formulas > Calculation Options. If it is set to Manual, press F9 to recalculate.

Frequently Asked Questions

Does UNIQUE count blanks?

No. UNIQUE ignores empty cells, so COUNTA(UNIQUE(range)) returns only the distinct non-blank values.

Can I count unique values across multiple columns?

Yes, but you need to combine columns first. Use =COUNTA(UNIQUE(A2:A100&"|"&B2:B100)) in Excel 365 or 2021, or the SUMPRODUCT/COUNTIFS version in older versions.

Why does my count include the header?

Because the header is a text value like any other. Start your range at row 2, or use a table reference that excludes the header.

Is there a difference between unique and distinct?

Excel's UNIQUE returns each value once, which is what most people mean by unique. Some database tools distinguish "distinct" (appears at least once) from "unique" (appears exactly once); Excel does not make that distinction by default.

Can I count unique values with a condition?

Yes, in Excel 365 and 2021 use =COUNTA(UNIQUE(FILTER(A2:A100,B2:B100="Open"))). In older versions you need a more complex SUMPRODUCT array formula.

Does the method work in Excel for Mac?

Yes. UNIQUE and SUMPRODUCT work the same in Excel for Mac, though menu labels may differ slightly by version and region.