How to Filter Unique Values Based on the First Column in Excel
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.

- 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.
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.
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.
Click on an empty cell where you want the filtered array to spill the resulting rows.
Type the formula =FILTER(B1:N1000,BYROW(B1:B1000,LAMBDA(r,COUNTIF(B1:r,r)=1))) and press Enter.
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 a Helper Column with COUNTIF
If dynamic array functions like LAMBDA are not available in your spreadsheet software, creating a helper column is a reliable and universally compatible alternative.
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. Open your dataset in WPS Spreadsheet: Launch WPS Office and open your spreadsheet containing the data to be filtered.
- 2. Apply the filtering formula: Select an empty cell and input your FILTER and COUNTIF logic to extract the unique rows dynamically.
- 3. Analyze the extracted data: Use WPS Spreadsheet's built-in formatting, pivot tables, and chart tools to further visualize your filtered results.

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.




