Foxcolab
Skip to content

FILTER, UNIQUE and SORT functions in Sheets

Pull matching rows with FILTER, list distinct values with UNIQUE, and order results with SORT and SORTBY in Foxcolab Sheets, with worked examples and fixes for

Updated 3 min read

In short

In Foxcolab Sheets, =FILTER(A2:D7, B2:B7="East") returns every row that matches, =UNIQUE(B2:B7) lists each value once, and =SORT(A2:D7, 4, -1) orders rows by the fourth column, largest first. Results spill into the cells below and update when the data changes. Combine conditions in FILTER with * for "and" and + for "or", because its third argument is the value to show when nothing matches.

Key takeaways

  • FILTER returns the rows where a TRUE/FALSE column is TRUE. Join conditions with * (and) or + (or).
  • FILTER's third argument is what to show when nothing matches. Without it, an empty result is
  • UNIQUE ignores capital letters, keeps the first spelling it finds, and returns values in the order they first appear.
  • SORT orders by column number, and SORTBY orders by another range. Blank cells always go last.
  • Results spill into empty cells. Anything in the way gives

Last reviewed 5 December 2026

The FILTER function in Foxcolab Sheets pulls out the rows that match a condition, UNIQUE lists each value once, and SORT puts rows in order. Each one fills a block of cells from a single formula and updates when the data changes, so a sales report or a contact list stays current without copying rows by hand. Sheets calculates everything in your browser, and the spreadsheet stays end-to-end encrypted.

The examples use this order list:

ABCD
1OrderRegionRepAmount
21001EastAsha1200
31002WestRavi450
41003EastMeena980
51004NorthAsha2300
61005WestRavi700
71006EastAsha150
  1. Pick an empty area

    Click a cell with enough empty cells below and to the right for the result, such as F2.

  2. Type the formula

    Type =FILTER(A2:D7, B2:B7="East") and press Enter.

  3. Read the result

    The three East orders fill F2:I4. Change a region in column B and the result updates.

FILTER and UNIQUE are also in the toolbar's Functions menu.

FILTER: rows that match#

Text
=FILTER(A2:D7, B2:B7="East")                       → orders 1001, 1003, 1006
=FILTER(A2:D7, (B2:B7="East")*(D2:D7>500))         → orders 1001, 1003
=FILTER(A2:D7, (B2:B7="East")+(B2:B7="North"))     → orders 1001, 1003, 1004, 1006
=FILTER(C2:D7, B2:B7="East")                       → rep and amount only
=FILTER(A2:D7, B2:B7="South", "No orders")         → No orders

The second argument is a column of TRUE and FALSE values, one per row. Multiply two conditions to require both, and add them to accept either. The optional third argument is what to show when nothing matches. Without it, an empty result shows #CALC!.

UNIQUE: each value once#

Text
=UNIQUE(B2:B7)                  → East, West, North
=UNIQUE(B2:C7)                  → each region and rep pair once
=UNIQUE(C2:C7, FALSE, TRUE)     → Meena (the only rep listed once)
=ROWS(UNIQUE(C2:C7))            → 3

UNIQUE keeps values in the order they first appear. It ignores capital letters, so East and east count as one value, and it keeps the spelling it meets first. Give it several columns to compare whole rows. Set the third argument to TRUE to list only values that appear exactly once.

UNIQUE leaves your data as it is. To delete duplicate rows instead, see Remove duplicates and clean up data in Sheets.

SORT and SORTBY: put rows in order#

Text
=SORT(A2:D7, 4, -1)                → by amount, largest first
=SORT(A2:D7, {2,4}, {1,-1})        → by region A to Z, then amount largest first
=SORTBY(C2:C7, D2:D7, -1)          → reps ordered by amount

SORT takes the number of the column to sort by and 1 for ascending or -1 for descending. Use braces to sort by several columns. SORTBY sorts by a separate range, which doesn't have to appear in the result. Numbers come before text, and blank cells always go last.

Combine them#

Text
=SORT(UNIQUE(B2:B7))                          → East, North, West
=SORT(FILTER(A2:D7, B2:B7="East"), 4, -1)     → East orders, largest first
=TAKE(SORT(A2:D7, 4, -1), 3)                  → the three biggest orders

To build a summary table, put =SORT(UNIQUE(B2:B7)) in F2, then =SUMIF(B2:B7, F2#, D2:D7) in G2. The # after F2 means the whole result, so G2:G4 shows 2330, 2300 and 1150, and a new region adds a row to both columns. For more on SUMIF, see Count and add with COUNTIF and SUMIF in Sheets.

Common mistakes#

  • A Google Sheets-style FILTER. =FILTER(A2:D7, B2:B7="East", D2:D7>500) treats the third argument as the "nothing matched" value, so it returns every East order. Multiply the conditions instead.
  • #SPILL!. Something is in the cells the result needs. Clear them and the result comes back.
  • Editing a result. Only the first cell holds the formula. To get values you can change, copy the result and choose Edit → Paste special → Values only.
  • Blank rows. A range with empty cells gives UNIQUE an empty entry. Leave them out with =UNIQUE(FILTER(B2:B100, B2:B100<>"")).
  • Text in the condition. FILTER's condition must be TRUE/FALSE or numbers. Text there gives #VALUE!.

For one-off sorting and filtering without formulas, see Sort and filter data in Sheets.

Frequently asked questions

Why does my FILTER formula ignore my second condition?

FILTER takes one condition. Its third argument is the value to show when no rows match, so a second condition there is never applied. Multiply the conditions instead, as in =FILTER(A2:D7, (B2:B7="East")*(D2:D7>500)).

Can I edit the cells a FILTER or SORT formula fills?

No. Only the first cell holds the formula. Typing into any other cell of the result blocks it and shows

Does UNIQUE treat "east" and "East" as the same?

Yes. UNIQUE ignores capital letters and keeps the spelling it meets first. The number 1 and the text "1" count as different values.

How do I count distinct values?

Wrap UNIQUE in ROWS or COUNTA, as in =ROWS(UNIQUE(C2:C7)). Leave blank cells out first with FILTER, or the blank counts as one value.

Did this answer your question?

One click, no account needed.

Still need help?

Our support team can take it from here.

Jump to