logo
search
Function Problems

How to Filter Unique Values Based on the First Column in Excel

Khadija KhanKhadija Khan Oct 13, 2026 868 views

Question details

The user wants to filter a dataset to return rows containing only the first occurrence of unique values from the first column, preferably using a dynamic-array formula without relying on a helper column.

How to Filter Unique Values Based on the First Column in Excel
Product
Excel
Device & OS
not provided
Scenario
Extracting unique records from a dataset based on duplicates in a specific column using advanced array formulas.
Observed behavior
The formula =FILTER(B1:N1000,UNIQUE(B1:B1000),"") fails to isolate the first occurrences properly, causing dimension mismatches or incorrect data extraction.
Before you start

Ensure your version of Excel or spreadsheet software supports dynamic array functions such as FILTER, BYROW, and LAMBDA, as these are required for advanced array operations without using helper columns.

Solution 1Recommended

Use BYROW and LAMBDA with the FILTER Function

This method dynamically filters the data array to return only the first occurrence of each value in the target column without needing a helper column.

The UNIQUE function cannot directly generate an array of TRUE/FALSE values required by the FILTER function's 'include' argument. By using BYROW and LAMBDA, you can iterate through the column and count occurrences dynamically.

1
Select the target cell

Click on an empty cell where you want the filtered array to spill the resulting rows.

2
Enter the dynamic formula

Type the formula =FILTER(B1:N1000,BYROW(B1:B1000,LAMBDA(r,COUNTIF(B1:r,r)=1))) and press Enter.

3
Review the extracted data

The formula will output the rows from B1:N1000 where the value in column B appears for the exact first time, automatically ignoring subsequent duplicates.

Use BYROW and LAMBDA with the FILTER Function
Formula Compatibility: The BYROW and LAMBDA functions are available in Microsoft 365 and modern spreadsheet applications supporting advanced dynamic arrays.
Efficient Data Filtering

Easily Filter and Process Unique Data with WPS Spreadsheet

WPS Office provides a powerful Spreadsheet application that supports advanced filtering functions, dynamic arrays, and seamless compatibility with Excel formulas. You can manage complex datasets and extract unique values efficiently.

  1. 1. Open your dataset in WPS Spreadsheet: Launch WPS Office and open your spreadsheet containing the data to be filtered.
  2. 2. Apply the filtering formula: Select an empty cell and input your FILTER and COUNTIF logic to extract the unique rows dynamically.
  3. 3. Analyze the extracted data: Use WPS Spreadsheet's built-in formatting, pivot tables, and chart tools to further visualize your filtered results.
Full compatibility with Microsoft Excel formulas and .xlsx file formatsSupports advanced functions for complex data analysis without lagLightweight, fast, and runs smoothly on multiple operating systems
QA img-9

Frequently Asked Questions

Why doesn't UNIQUE work directly inside the FILTER function's include argument?

The FILTER function requires an array of TRUE/FALSE (or 1/0) values of the exact same height as the source array. The UNIQUE function returns a shrunken array of just the distinct values, which causes a dimension mismatch and results in a calculation error.

What does the LAMBDA function do in this formula?

LAMBDA defines a custom, unnamed function on the fly. In this specific formula context, it takes each row passed by the BYROW function and calculates a running COUNTIF to determine if it is the very first time that specific value has appeared in the column.

Is there a way to permanently remove duplicates instead of filtering them?

Yes. If you do not need a dynamic formula, you can select your entire dataset, navigate to the Data tab on the ribbon, and click the 'Remove Duplicates' button. Select only the first column in the prompt to permanently delete all duplicate rows based on that column.