WorkbookLogic
FormulaFreeDynamic ArraysbeginnerUNIQUEFILTERROWSCOUNTIFCOUNTAIFAND

Return Unique Nonblank Values

By WorkbookLogic

Create a dynamic distinct list in first-appearance order by filtering blank source cells before applying UNIQUE, while keeping the spill range clear and independently checked.

ExcelLast reviewed Sep 11, 2026
unique-values-v1.0.0.xlsxFree
Unique Values
UNIQUE spills one instance of each value; FILTER removes blanks first.
Function review, dynamic distinct lists
SourceFormula syntaxUnique outputCountBehavior
North=UNIQUE(FILTER(A12:A17,A12:A17<>""))North3Spills North, South, East
SouthSouth
NorthEast
East
South
Reliability checks
Distinct nonblank count is 3OK

Overview

Return one instance of every nonblank value in a source list. FILTER removes blank cells before UNIQUE evaluates the array, and the result spills in the order each value first appears.

When to use it

Use it to create changing category or dropdown sources, identify distinct customers, products, or regions, build summary dimensions, or review the domain of imported data.

When not to use it

Wrap the result in SORT when alphabetical or numeric order matters. Use Remove Duplicates for a one-time static result. Power Query is preferable for large governed imports and repeatable transformations. A frequency table requires counts alongside the distinct list.

Problem

A manually maintained list becomes stale as source categories change. UNIQUE alone can return a blank as a distinct result, and typing below the formula blocks expansion. The calculation needs both blank removal and reserved spill space.

Source data

The editable synthetic region list in Combined Example!B18:B28 is:

Row

Region

1

North

2

South

3

North

4

East

5

West

6

South

7

blank

8

Central

9

East

10

North

11

West

Values are text. Hidden spaces and inconsistent spelling remain distinct until the source is cleaned.

The source order is material to presentation because UNIQUE preserves first appearance. Duplicate entries are intentionally allowed, while the blank row is deliberately excluded before the distinct list is created.

Calculations

  1. Test every source cell for nonblank content.
  2. FILTER the bounded range using that Boolean array.
  3. Pass the nonblank result to UNIQUE.
  4. Preserve first-appearance order.
  5. Spill the result from one anchor and count the returned rows.

Outputs

The formula returns five rows: North, South, East, West, and Central. The order follows first appearance, not alphabetical sorting. A companion count returns 5.

Formula map

=UNIQUE(FILTER(B18:B28,B18:B28<>""))

Enter the formula once at the spill anchor. Both FILTER ranges are identical and bounded. The output expands vertically; do not fill the formula down.

To count the same result:

=ROWS(UNIQUE(FILTER(B18:B28,B18:B28<>"")))

Model checks

The workbook confirms that the spill contains five nonblank values, every returned value exists in the source, and the output contains no duplicates. Passing controls return OK.

Edge cases

  • A blank is removed before UNIQUE runs.
  • Repeated values appear once.
  • Hidden spaces create separate entries.
  • Occupied destination cells cause #SPILL!.
  • An entirely blank source can make FILTER return a calculation error because no fallback is supplied.
  • Source errors can propagate into the spill.

Common errors

  • Applying UNIQUE directly: a blank may appear as a category. Filter blanks first.
  • Typing in the spill area: expansion fails. Edit only the source or anchor formula.
  • Expecting sorted output: UNIQUE preserves first appearance. Add SORT if needed.
  • Using oversized source ranges: performance and blank behavior become harder to control. Use a bounded range or table.

Example

North first appears in row 1 and its later occurrences are removed. South, East, and West follow; the blank in row 7 is filtered out; Central becomes the fifth result. The five-row output therefore matches the distinct nonblank domain of the source.

Example workbook

Edit the cream regions in Combined Example!B18:B28. The distinct list spills from G18, with count and status outputs nearby. Formula Review demonstrates UNIQUE and FILTER separately on a smaller list.

Key takeaway

Filter blanks before applying UNIQUE, preserve an empty spill path, and add SORT only when the required order differs from the source’s first appearances.