Counting populated cells and counting distinct values answer different questions. Define which blanks and invalid entries should be excluded before reporting a unique-customer or unique-code total.
Define the population
COUNTA counts values rather than distinct entities. Repeated IDs still contribute repeated entries. COUNTUNIQUE counts distinct values, but the source range should first represent the population you actually intend to measure.
Keep the header outside the range. Inspect empty cells, formulas returning empty strings, and cells containing spaces. These can look similar while representing different stored content.
Exclude unwanted empty entries explicitly
For a single text-ID column, =COUNTUNIQUEIFS(A2:A100,A2:A100,"<>") counts distinct values meeting the nonempty criterion. Google explicitly documents zero when no records satisfy COUNTUNIQUEIFS criteria. Space-only text and invalid IDs still require separate review.
This is a distinct-value count for one field, not a count of unique multicolumn records. Do not concatenate arbitrary fields without a collision-safe record definition when your question concerns a combination of attributes.
Compare a known sample
Test a list containing two copies of one ID, a different ID, and blanks, then test an entirely empty population. A FILTER error can itself be counted by a surrounding count operation, so an outer error wrapper is not a reliable substitute for this empty-case check.
Preserve raw identifiers before normalization. Removing spaces or changing case can merge records that the source system treats as different. Keep invalid and missing IDs visible in an exception count rather than silently excluding them from every report. A useful unique count states its range, exclusion policy, and definition of identity so readers know what the number actually represents.
References
Reviewed against the linked official product guidance on November 3, 2026. Features, limits, screen labels, and access can vary by account, platform, region, and organization policy.