Contact

COUNTUNIQUE Function in Google Sheets: Syntax, Examples & Compatibility

Math Beginner Google Sheets

Learn how to count the distinct values in a set of text labels in Google Sheets. Includes syntax, two verified-by-reasoning results, troubleshooting and portability notes.

Verification status: See the evidence and test scope described in this guide. How formula examples are checked

Quick answer: count the distinct values in a set of text labels in Google Sheets. The reproducible examples below use explicit values so the formula’s meaning is testable without a large workbook.

Evidence: The function name and syntax are documented in the linked vendor function reference. Expected outputs were independently reasoned or checked outside the application. These are not native Google Sheets test results. A guide being published here does not certify every software release or file-import scenario.

Availability and version history

  • Introduced: Introduction version not established by the official history reviewed.
  • Availability: Documented in the rolling Google Sheets service; examples use the web spreadsheet workflow.
  • Checked: October 14, 2026; official COUNTUNIQUE reference. Documentation check, not a new native test; existing example-verification notes retain their scope.

Syntax and arguments

=COUNTUNIQUE(value1, [value2, ...])

Supply at least one value or range, with optional additional values/ranges. Repeated identical entries contribute one distinct value. Google’s worksheet notes say the apparent 30-argument specification is not a fixed maximum in Sheets.

The same help page also has a separate BigQuery one-column signature. This guide uses the worksheet value/range signature, not the BigQuery form. It counts distinct cell values rather than returning their list or automatically counting distinct multi-column records.

Best use case: Count the distinct values in a set of text labels.

Set up the example sheet

Create a small list of repeated item names to check distinct stock-keeping units, or test the literals below without a worksheet table.

Enter the formula in an unused cell. For a formula returning several values, leave an unobstructed area where those values can expand. These formulas use comma argument separators in a typical English-language locale; commas or semicolons inside quoted text are data, not argument separators. Adapt the separator if your regional settings require it.

Worked example 1: COUNTUNIQUE with known input

=COUNTUNIQUE("Pen","Pad","Pen")

Expected output: 2.

Pen occurs twice but counts only once; Pad is the second distinct value.

Worked example 2: a second COUNTUNIQUE case

=COUNTUNIQUE("East","East","West","North")

Expected output: 3.

There are three distinct team labels: East, West and North.

Compare both results before replacing literal values or short sample ranges with your own workbook data. For a spilling formula, compare every output cell, not only the top-left result.

Count a list and its distinct membership

Enter Pen, Pad, Pen, Box, Box in A2:A6:

=COUNTUNIQUE(A2:A6)

Expected result: 3, representing Pen, Pad and Box. Only Pad appears exactly once, but the function is not counting only single-occurrence entries. Repeated values still belong to the distinct set.

UNIQUE can return the actual distinct list when the identities, not just the count, are needed. This example does not depend on the order of that list.

Advanced example: additional ranges form one comparison set

Enter Pad, Tape, Tape in C2:C4:

=COUNTUNIQUE(A2:A6,C2:C4)

Expected result: 4, for Pen, Pad, Box and Tape. The separate counts are 3 and 2, whose sum is 5. Adding the two counts double-counts Pad because it occurs in both ranges.

Passing the first range twice, =COUNTUNIQUE(A2:A6,A2:A6), still gives 3. Overlapping supplied records do not create a new distinct value by themselves. Adding the literal “Folder” as another argument increases the combined-range count from 4 to 5.

Advanced example: cells are not row identities

Create E2:F5 with rows 1,1; 1,2; 2,1; 2,2:

=COUNTUNIQUE(E2:F5)

Expected result: 2, because the cells contain only the numeric values 1 and 2. There are four different two-column row combinations, but that is a different question. Do not read the returned 2 as a count of distinct records.

In each column alone the count is also 2. The counts cannot simply be added to obtain the distinct count across both columns, because their values overlap.

Preserve the intended equality policy

For numeric values 0,0,2,2,5 in H2:H6, the expected count is 3. Zero is an ordinary distinct numeric value in this control. No blanks or numeric-looking text are mixed into the example.

The dedicated help does not specify a complete equality matrix for case variants, blank cells, empty strings, errors and mixed numeric/text representations. Keep those boundaries explicit rather than assuming the semantics of COUNTA or another program’s UNIQUE implementation.

For imported labels, define any trimming or case-normalization step separately and retain the source labels. A count can decrease after normalization because formerly different strings were intentionally mapped to the same label; that alone does not show that the import was wrong.

Practical advice and troubleshooting

When this formula helps: To generate the actual list of distinct values, use UNIQUE; COUNTUNIQUE only returns the count.

Important edge case: Define how imported labels should be normalized before counting. This guide does not establish case, blank, empty-text or mixed numeric/text equality rules from the sparse dedicated reference.

If the result differs, first verify the text-versus-number types of the input cells, the argument separators for your locale, and the range size. For dynamic arrays, inspect occupied cells in the output area. For an imported file, check that the formula is being evaluated in Google Sheets and that its ranges and text survived conversion.

Compatibility and version considerations

Excel does not have a direct COUNTUNIQUE worksheet function; modern Excel can count a UNIQUE array, but syntax differs.

Google Sheets is a rolling web service. Confirm the sheet locale and the full result area when checking an imported formula.

Function availability and parameter behavior must be judged for the specific application and release; a function documented in one spreadsheet does not automatically work in another.

Editorial verification: Full dedicated reference and current manuscript reviewed October 14, 2026. Original and added outputs were independently calculated; no native application run, screenshot, or version-specific output is claimed. Review the editorial testing standards if you require stronger proof before importing a workbook.