Function Problems

How to Filter Duplicate Values from Dynamic Excel Arrays

Algirdas JasaitisAlgirdas Jasaitis Nov 11, 2026 869 views

Question details

The user needs to extract records from a dynamic array where the value in the first column appears more than once.

How to Filter Duplicate Values from Dynamic Excel Arrays
Product
Excel
Device & OS
not provided
Scenario
Combining data from multiple tables into a dynamic array and attempting to filter out strictly unique rows to analyze the duplicates.
Observed behavior
The standard COUNTIF function fails and returns an error because it does not accept an in-memory calculated array as its range argument.
Before you start

Ensure you are using a spreadsheet application version that supports modern dynamic array functions such as LET, FILTER, VSTACK, and HSTACK.

Solution 1Recommended

Filter Duplicates Using MAP, LAMBDA, and SUM

Since COUNTIF does not accept in-memory dynamic arrays, use a combination of MAP and SUM to evaluate the occurrences of each value.

This method loops through the target column using the MAP and LAMBDA functions, summing up the boolean matches to determine if a value appears more than once.

1
Define the data array

Use the LET function to define your combined data. For example, combine your tables using VSTACK and HSTACK to create a unified array named 'tbl'.

2
Extract the target column

Define 'col' inside the LET function using CHOOSECOLS(tbl, 1) to isolate the first column of your combined array for duplicate checking.

3
Count occurrences dynamically

Apply the logic MAP(col, LAMBDA(r, SUM(N(col=r))>1)) to iterate through each row and check if its value appears more than once in the column.

4
Filter the array

Wrap the MAP logic inside a FILTER function like FILTER(tbl, [MAP logic], "") to return only the rows that meet the duplicate condition.

Filter Duplicates Using MAP, LAMBDA, and SUM
Formula Advantage: This formula effectively bypasses the COUNTIF limitation by calculating the matches directly in memory.

Easily Handle Dynamic Arrays and Complex Formulas in WPS Spreadsheet

WPS Office provides robust support for modern dynamic array functions like FILTER, UNIQUE, and XMATCH, allowing you to manipulate and filter complex datasets without limitations.

  1. 1. Open your data: Launch WPS Spreadsheet and open the workbook containing your dataset.
  2. 2. Select target cell: Click on the empty cell where you want the dynamic array results to spill over.
  3. 3. Enter the formula: Type out your dynamic array formula using LET, FILTER, and UNIQUE.
  4. 4. Execute the function: Press Enter to automatically calculate and populate the filtered duplicate records.
Full compatibility with Microsoft Excel's modern array formulas.Free, lightweight, and fast processing for large datasets.Intuitive interface with powerful data analysis tools.
microsoft office alternative - wps office

Frequently Asked Questions

Why doesn't COUNTIF work with dynamic arrays?

The COUNTIF and COUNTIFS functions require a physical worksheet range as their first argument. They cannot process in-memory calculated arrays (like those generated by VSTACK or CHOOSECOLS), which results in a formula error.

What does the '1' in the UNIQUE function argument do?

In the formula UNIQUE(array, [by_col], [exactly_once]), setting the third argument to 1 (or TRUE) forces the function to return only the values that appear exactly once in the dataset, rather than returning a list of all distinct values.

Can I filter duplicates based on multiple columns instead of just the first?

Yes. You can concatenate the columns you want to check within the LET function or adjust the CHOOSECOLS arguments, then perform the XMATCH or MAP logic on that combined criteria array.