Extract, Sort, and Remove Duplicates with FILTER, SORT, and UNIQUE (No Power Query Needed)

Use Excel FILTER, SORT, and UNIQUE to create conditional extracts, multi-level sorts, unique values, and unique combinations in real time. A complete guide to practical examples, including AND/OR conditions, multi-column returns, multiple sort criteria, exactly once, top N extraction, and fixing spill errors.
Extract, Sort, and Remove Duplicates with FILTER, SORT, and UNIQUE (No Power Query Needed)

Extract, Sort, and Remove Duplicates with FILTER, SORT, and UNIQUE (No Power Query Needed)

Even without PivotTables or Power Query, you can use the three dynamic array functions to create real-time lists, top N results, and unique values. Your reports update automatically.

Syntax and Options

FunctionSyntaxKey Point
FILTER=FILTER(array, include, [if_empty])include is a TRUE/FALSE array. Combine conditions with + for OR and * for AND.
SORT=SORT(array, [sort_index], [sort_order], [by_col])sort_order: 1 for ascending and -1 for descending. Use by_col to switch between sorting by rows and columns.
SORTBY=SORTBY(array, by_array1, [order1], [by_array2], [order2], ...)Sort by another range using multiple criteria.
UNIQUE=UNIQUE(array, [by_col], [exactly_once])Set by_col=TRUE to remove duplicates by column, or exactly_once=TRUE to return only values that appear once.

FILTER — Conditional Extraction

Example 1) Region = Seoul AND Status = Delivered

=FILTER(A2:E100, (B2:B100="Seoul")*(E2:E100="Delivered"), "No results")

Example 2) Product is Keyboard or Mouse

=FILTER(A2:E100, (C2:C100="Keyboard")+(C2:C100="Mouse"))

Example 3) Date range

=FILTER(A2:E100, (D2:D100>=F2)*(D2:D100<=G2), "No results")

SORT and SORTBY — Sorting

Example 4) Sort sales in descending order

=SORT(B2:D100, 3, -1)

Example 5) Region ascending, then date descending (multiple criteria)

=SORTBY(A2:E100, B2:B100, 1, D2:D100, -1)

UNIQUE — Unique Values and Exactly Once

Example 6) Unique list of regions

=UNIQUE(B2:B100)

Example 7) Order numbers that appear exactly once

=UNIQUE(A2:A100,,TRUE)

Example 8) Unique combinations of region and product

=UNIQUE( CHOOSECOLS(A2:E100,2,3) )

9 Practical Patterns

① Filter → Sort → Top N

=TAKE(SORT(FILTER(A2:E100, B2:B100="Seoul"), 5, -1), 10)

② Monthly unique customer count

=COUNTA(UNIQUE(FILTER(Customer, (Date>=EOMONTH(F2,-1)+1)*(Date<=EOMONTH(F2,0)))))

③ Sum after removing duplicates (spill reference)

=LET(u, UNIQUE(A2:A100), BYROW(u, LAMBDA(r, SUMIF(A2:A100, r, C2:C100))))

④ Live list containing a search term

=FILTER(A2:A100, ISNUMBER(SEARCH($H$2, A2:A100)))

⑤ Sort by column (by_col)

=SORT(A1:G5,,,-1)   // Sort by columns rather than rows

⑥ List and sort customers who appear exactly once

=SORT(UNIQUE(A2:A100,,TRUE))

⑦ Conditional unique combinations (product combinations in Seoul)

=UNIQUE(FILTER( HSTACK(Region, Product), Region="Seoul" ))

⑧ Keep only the top N%

=LET(s, SORT(A2:C100,3,-1), TAKE(s, ROUNDUP(ROWS(s)*0.2,0)))

⑨ Connect with XLOOKUP (unique customers → details)

=XLOOKUP(UNIQUE(Customer), Customer, HSTACK(Address, Phone))

Spill, Performance, and Error Handling

  • #SPILL! → Clear the spill range and make sure the formula is not inside a table.
  • No results → Use FILTER's if_empty argument to display a message.
  • Letter case → Standardize with SEARCH/LAMBDA (UPPER/LOWER) before comparing.
  • Performance → Cache repeated calculations with LET, and use tables instead of whole-column references.

Summary

GoalTypical Formula
Conditional extractionFILTER(range, criteria, "No results")
Multi-level sortingSORTBY(range, criteria1,order1, criteria2,order2)
Unique values/exactly onceUNIQUE(range,,TRUE/FALSE)
Top NTAKE(SORT(FILTER(...),column,-1), N)

FAQ

How is this different from a PivotTable?

PivotTables create summary tables, while dynamic arrays use cell formulas to create real-time lists, sorted results, and unique values. They are well suited for embedding in reports and pipelines.

How do I apply multiple sort criteria?

Use SORTBY and list each sort range and sort order in sequence.

Try using FILTER → SORT → TAKE on your sheet now to create a “Top 10 in Seoul” list. Your report will update automatically.

Leave a Reply

Your email address will not be published. Required fields are marked *