FILTER and UNIQUE Functions: Build Live Lists Without Copying

FILTER returns the rows of a range that meet a condition. UNIQUE returns each distinct value once. Together they let a workbook build a list by formula, so the list changes when the source changes and nobody has to copy and paste it again.

Most problems with these functions come from how their results spill into neighbouring cells, and from blank or inconsistent source data. The syntax is short. The rules around it are where people lose time, so this SOP covers both.

Glossary and Scope

This SOP applies to Excel for Microsoft 365, Excel 2021, Excel for the web and Google Sheets. Older versions of Excel do not support these functions.

The terms used throughout are as follows:

  • Source range: the block of cells the formula reads, for example A2:F500.
  • Include array: the condition FILTER applies to each row, which evaluates to TRUE or FALSE for every row.
  • Spill range: the block of cells a dynamic array formula fills with its results.
  • Spill anchor: the single cell containing the formula. Results appear from this cell downwards and across.
  • Structured reference: a reference to a named Excel Table, such as tblOrders[Region], which expands when rows are added.

Some European locales use semicolons instead of commas as argument separators. The logic is identical, so translate the separators and continue.

Plumline Client Tracker (CRM)

Skip the setup

Plumline Client Tracker (CRM)

Every client, lead and follow-up in one sheet, with drop-downs and status colours already set up.

See it on Taskdale →

How FILTER Works

SOP 1.1: Syntax and Arguments

The syntax is:

=FILTER(array, include, [if_empty])

  • array is the range to return. It can be one column, several columns or the whole table.
  • include is the condition, written as an array of TRUE and FALSE values with one entry per row.
  • if_empty is optional text or a value to show when nothing matches.

A simple example returns every column for rows where Status is “Open”:

=FILTER(A2:F500, E2:E500="Open")

The output keeps the source order. If you need a different order, wrap the formula in SORT, which is covered in Module 3.

SOP 1.2: Writing the Include Condition

The include argument must return the same number of rows as the array. If the array runs to row 500 and the condition stops at row 400, the formula returns a #VALUE! error.

Comparisons against a cell are the most useful form. Anchor the reference with dollar signs so it does not shift when the formula is copied:

=FILTER(A2:F500, E2:E500=$H$1)

Here H1 holds the status to match. Changing H1 changes the list, which is the basis of most interactive reports.

SOP 1.3: Combining Conditions with AND and OR

Combine conditions by multiplying them for AND and adding them for OR. Each condition must sit in brackets.

For rows that are both open and above 1,000 in value:

=FILTER(A2:F500, (E2:E500="Open")*(D2:D500>1000))

For rows that are either “Open” or “On hold”:

=FILTER(A2:F500, ((E2:E500="Open")+(E2:E500="On hold"))>0)

Wildcards such as * do not work inside FILTER conditions. To match text that contains a word, use ISNUMBER(SEARCH("term", range)), which returns TRUE for any row containing the term.

SOP 1.4: Setting the if_empty Message

When no row matches, Excel returns #CALC! and Google Sheets returns #N/A. Both look like faults to the person reading the sheet. Supply the third argument to replace the error with a message:

=FILTER(A2:F500, E2:E500=$H$1, "No open orders for this region")

Use a message that tells the reader what the empty result means. “None” is less useful than “No matching orders for this region”.

How UNIQUE Works

SOP 2.1: Syntax and Arguments

The syntax is:

=UNIQUE(array, [by_col], [exactly_once])

  • array is the range to examine.
  • by_col is optional. It is FALSE by default, which compares rows. TRUE compares columns.
  • exactly_once is optional. It is FALSE by default, which returns every distinct value. TRUE returns only values that appear once.

A basic example returns the distinct regions in column C:

=UNIQUE(C2:C500)

SOP 2.2: Row Comparison and Column Comparison

By default, UNIQUE treats each row as a single item and removes duplicate rows. For a single column, this is the behaviour most people want.

If the source holds several columns and you want unique combinations, keep the default. For example, =UNIQUE(B2:C500) returns each distinct Region and Rep pairing once. Setting by_col to TRUE is rare in practice. It is useful when your data is laid out across rows, such as a set of monthly headings in a single row.

SOP 2.3: Returning Values That Appear Once

The third argument returns only values that occur exactly once in the source:

=UNIQUE(A2:A500, FALSE, TRUE)

This is useful for finding orders that have no duplicate, customers with a single purchase or product codes that were entered only once. It is less useful for finding duplicates. For the reverse, filter the source with a COUNTIF test, or use the Remove Duplicates tool when you need to clean the data rather than report on it.

SOP 2.4: Case, Spacing and Blank Cells

UNIQUE is not case-sensitive. “North”, “NORTH” and “north” count as one value, and the first occurrence is the one returned.

UNIQUE does not trim spaces. “North” and “North ” (with a trailing space) are treated as two different values, and both appear in the output. Clean the source with TRIM, or correct the data at entry.

Blank cells can come through as zero in the spilled result. When the source contains gaps, filter them out before applying UNIQUE:

=UNIQUE(FILTER(C2:C500, C2:C500<>""))

Combining FILTER and UNIQUE

Nesting the two functions is where most of the practical value lies. Each combination below answers a specific reporting question.

SOP 3.1: Sorted Unique Lists with SORT

UNIQUE returns values in the order they first appear. To produce an alphabetical list, wrap it in SORT:

=SORT(UNIQUE(C2:C500))

This is the standard way to build a dropdown source or a list of categories that will not change order when new rows are added.

SOP 3.2: Unique Values Within a Filtered Result

Apply FILTER first, then UNIQUE, to answer questions about a subset:

=UNIQUE(FILTER(D2:D500, E2:E500="Open"))

This returns the distinct reps who currently hold open orders. Reverse the order of the functions and the result changes. UNIQUE applied first would return the distinct reps across all orders, and FILTER would then find no matching condition for the filtered list.

SOP 3.3: Dependent Dropdown Lists

A common pattern is a dropdown in one cell that controls a list elsewhere. Place the unique list of options in a helper column, then point the data validation rule at it.

In Excel 365, the spill reference operator (#) refers to the whole spilled range. If the unique list starts in J2, the validation source is:

=$J$2#

In Google Sheets, the # operator is not available. Use a named range that covers a fixed block, such as J2:J50, and accept that the named range will not grow beyond its size.

Binsight Inventory Spreadsheet

Ready-made template

Binsight Inventory Spreadsheet

Stock in, stock out and reorder alerts that turn red before you run out. Uses lookups and conditional formatting.

See it on Taskdale →

Choosing Between FILTER, UNIQUE and the Alternatives

Dynamic array functions are one option among several. The table below compares them on the attributes that usually decide the choice.

MethodBest forUpdates automaticallySetup effortMain limitation
FILTER formulaSubsets of rows shown in a reportYesLowNeeds Excel 2021 or later, or Google Sheets
UNIQUE formulaDistinct lists for dropdowns and summariesYesLowNeeds Excel 2021 or later, or Google Sheets
PivotTableTotals, counts and averages by categoryOn refreshMediumLayout is fixed and not formula-based
Power QueryLarge datasets and repeatable cleaning stepsOn refreshHighRefresh must be triggered and is not live
Copy and paste valuesOne-off snapshots for a single recipientNoVery lowGoes stale as soon as the source changes
AutoFilterManual inspection of a single sheetOnly when reappliedVery lowHides rows rather than producing a separate list

Use the following rules to decide:

  • Use FILTER when the list must reflect live data and the reader will view it in the same workbook.
  • Use UNIQUE for distinct lists that feed dropdowns, validation rules or summary headings.
  • Use a PivotTable when the question is about totals, not individual rows.
  • Use Power Query when the source is very large, needs cleaning each time, or comes from outside the workbook.
  • Use pasted values only when the recipient must receive a fixed record that will not change.

Common Mistakes

SOP 5.1: Fixed Ranges That Miss New Data

A formula that reads A2:F500 ignores row 501 onwards. The list looks complete until the day it is not. Convert the source to an Excel Table with Ctrl+T, then reference the table by name, such as tblOrders[Status]. The reference expands as rows are added.

SOP 5.2: Spill Blocked by Existing Content

If any cell below the anchor cell is not empty, the formula returns #SPILL!. The fix is to clear the blocking cells or move the formula. Do not place notes, totals or headers in the column beneath a spilled list.

SOP 5.3: Editing Inside a Spilled Range

A cell within a spilled result cannot be edited individually. Attempting to type into it produces an error about a spilled array. Change the source data or the formula in the anchor cell instead.

SOP 5.4: Including the Header Row

If the source range starts at row 1 and the first row is a header, the header appears in the output as data. Start the range at row 2, or use a structured reference, which excludes the header automatically.

SOP 5.5: Mismatched Array Lengths

When the include condition and the array cover different numbers of rows, the formula fails. This usually follows an edit that inserted rows into one range but not the other. Structured references prevent this because both arguments reference the same table.

SOP 5.6: Numbers Stored as Text

A condition such as B2:B500>1000 will not match a value that looks like a number but is stored as text. Such values often arrive from exported files. Convert the column with VALUE, or fix the import settings. Dates have the same problem, and their comparisons fail silently.

Worked Example: Open Orders by Region

This example builds a live report from an orders log. The report lets the user select a region and see the open orders for it, along with a count of the reps involved.

SOP 8.1: Prepare the Source

The orders sheet contains these columns in A to F: Order ID, Date, Region, Rep, Value and Status. Select the data and convert it to a table with Ctrl+T. Name the table tblOrders in the Table Design tab.

Each new order added directly below the table extends the table automatically, and the formulas update with it.

SOP 8.2: Build the Region Dropdown

On a reports sheet, enter the following in J2:

=SORT(UNIQUE(tblOrders[Region]))

This produces an alphabetical list of regions. Leave the cells below J2 clear so the list can spill.

In H2, add a data validation rule with the list source =$J$2#. The dropdown now offers every region currently in the log, and it updates when a new region is added.

SOP 8.3: Build the Filtered Order List

In H5, enter:

=FILTER(tblOrders[[Order ID]:[Value]], (tblOrders[Region]=H2)*(tblOrders[Status]="Open"), "No open orders for this region")

The structured reference tblOrders[[Order ID]:[Value]] returns the first five columns of the table. The condition requires both the selected region and an Open status.

Suppose the log holds twelve orders, and four of them are North orders with an Open status. Selecting North in H2 returns four rows beginning at H5. Selecting a region with no open orders returns the message in the third argument.

SOP 8.4: Count the Reps Involved

In H3, enter:

=COUNTA(UNIQUE(FILTER(tblOrders[Rep], (tblOrders[Region]=H2)*(tblOrders[Status]="Open"))))

This counts the distinct reps with open orders in the selected region. It uses the same condition as the list above, so the two figures cannot disagree.

Be aware that COUNTA counts the message text if no rows match. Where that matters, wrap the formula in IF and test for an empty result first.

SOP 8.5: Test the Build

Run three tests before handing over the report:

  1. Add a new order with a new region at the bottom of the table. The dropdown should include it.
  2. Change the status of one North order from Open to Closed. The filtered list should drop one row.
  3. Select a region that has no open orders. The message should appear, and H3 should not show a stale count.

If any test fails, check the table name and the spill area first. Most failures come from those two sources.

Checklist Before Relying on a Live List

Work through these checks before a FILTER or UNIQUE list goes into regular use:

  • The source is an Excel Table, or the ranges extend past the last expected row.
  • The anchor cell has nothing beneath it in the spill area.
  • Every FILTER includes an if_empty message.
  • Blank and text-stored numbers are removed or converted in the source.
  • The workbook will not be opened in a version older than Excel 2021 or a non-dynamic-array environment.
  • Formats and conditional formatting cover the rows the list is expected to reach.
  • The three tests in SOP 8.5 pass on a copy of the live data.

If a list must go to a reader who only needs a fixed record, paste the values and stop there. If the list must answer questions for someone who will keep adding data, build it with FILTER and UNIQUE on a table, and test it against the case that will break it first.

Lumora Project Command Center

Get the finished file

Lumora Project Command Center

Plan projects with tasks, status drop-downs, progress bars and a dashboard view.

See it on Taskdale →

Scroll to Top