Formula Errors

How to Use an Excel Formula to Detect Duplicate Values in Selected Cells in WPS Spreadsheets

Nimra MalikNimra Malik Nov 13, 2026 869 views

Question details

The user needs an Excel-compatible formula that displays "Error" when two or more selected nonblank cells contain the same value, comparing the number of selected cells with the number of unique values.

How to Use an Excel Formula to Detect Duplicate Values in Selected Cells
Product
WPS Spreadsheets
Device & OS
not provided
Scenario
The user is creating a spreadsheet validation rule and wants to flag duplicate entries in selected cells such as A1, A3, A5, A7, A9, and A11.
Observed behavior
The formula should return "Error" only when duplicate nonblank values exist in the selected cells; otherwise it returns an empty string.
Before you start

Check that your WPS Spreadsheets version supports the functions you plan to use. WPS Office 2021 or later can handle LET, FILTER, and UNIQUE, while the COUNTIF method works in all modern WPS and Excel versions.

Solution 1Recommended

Use LET, FILTER, and UNIQUE to Detect Duplicates in Non-Contiguous Selected Cells

Use this method when you need to check specific cells such as A1, A3, A5, A7, A9, and A11 without counting intervening blank cells or other rows.

This formula filters the selected cells by row position and ignores blanks, then compares the number of rows in the filtered result with the number of unique values. If the unique count is smaller, at least one duplicate exists.

1
Select the result cell

Click the cell where you want the result to appear, such as B1.

2
Enter the formula

Type =LET(x,FILTER(A1:A11,ISODD(ROW(A1:A11))*NOT(ISBLANK(A1:A11))),IF(ROWS(UNIQUE(x))<ROWS(x),"Error","")) in the formula bar and press Enter.

3
Verify the output

If two or more of the selected nonblank cells contain the same value, the result cell displays Error; otherwise it remains empty.

Use LET, FILTER, and UNIQUE to Detect Duplicates in Non-Contiguous Selected Cells
Tip: Use named ranges for easier maintenance: If the selection may change, name the filtered range or store the cell addresses in a helper column before applying the formula.
WPS Spreadsheets formula solution

Detect Duplicate Values in Selected Cells with WPS Spreadsheets

You can complete this directly in WPS Spreadsheets using Excel-compatible formulas. Enter the LET, FILTER, and UNIQUE formula for non-contiguous selected cells, or use COUNTIF for a contiguous range, and WPS will return "Error" when duplicates are found.

  1. 1. Open WPS Spreadsheets: Launch WPS Office on your computer and open the workbook where you want to detect duplicate values.
  2. 2. Select the result cell: Click the cell where you want the formula result to appear, for example B1.
  3. 3. Enter the duplicate detection formula: Type =LET(x,FILTER(A1:A11,ISODD(ROW(A1:A11))*NOT(ISBLANK(A1:A11))),IF(ROWS(UNIQUE(x))<ROWS(x),"Error","")) and press Enter. For a contiguous range, use =IF(MAX(COUNTIF(A1:A11,A1:A11))>1,"Error","").
  4. 4. Check the result: If any two selected nonblank cells contain the same value, the cell displays Error; otherwise it stays blank.
Uses native Excel-compatible formulas such as LET, FILTER, UNIQUE, and COUNTIFNo extra add-ins or VBA macros requiredWorks with .xlsx, .xlsm, and other Microsoft Excel file formatsLightweight and free with a familiar ribbon interfaceFast duplicate validation for selected spreadsheet cells
microsoft office alternative - wps office

Frequently Asked Questions

Can I use this formula in WPS Spreadsheets if I don't have Microsoft 365?

Yes. WPS Spreadsheets supports many Excel formulas. The simpler =IF(MAX(COUNTIF(A1:A11,A1:A11))>1,"Error","") works for a contiguous range, while LET, FILTER, and UNIQUE require a version with dynamic array support.

How do I adapt the formula for selected cells that are not every other row?

Replace the ISODD(ROW(A1:A11)) condition with your own condition, or place the specific cells in a helper range. The principle remains the same: filter to the desired nonblank cells and compare ROWS(UNIQUE(x)) with ROWS(x).

Why does the formula return a formula error instead of the word Error?

Check that your function names match your language version of WPS or Excel and that text strings are enclosed in double quotes, such as "Error". In older versions, LET and FILTER may not be available, so use the COUNTIF method instead.

What if I want to highlight duplicates instead of returning Error?

In WPS Spreadsheets, select the range, go to Home > Conditional Formatting > Highlight Cells Rules > Duplicate Values, and choose a highlight style.

Does the COUNTIF method count blank cells as duplicates?

Yes, if a contiguous range contains multiple blank cells, they can be counted as duplicates. To ignore blanks, combine COUNTIF with COUNTIFS or wrap the formula so blanks are excluded before checking.