How to Find Duplicates Across Multiple Columns in Google Sheets: Rows That Match on Two or More Columns, and Values Repeated Anywhere in a Range (2026)
“Find duplicates across multiple columns” means two different things, and the formula you need depends on which one you have. Either a row is a duplicate when several of its columns match another row (the same person signed in twice on the same date), or a value is a duplicate when it shows up anywhere in a block of columns (the same student placed in two project groups, the same SKU typed in two different columns). The built-in Data › Data cleanup › Remove duplicates tool handles the first case and can’t see the second at all. This guide covers both, with a worked example for each.
The short answer
- Rows that match on two or more columns: count the combination with COUNTIFS, one range/criterion pair per column, for example
=COUNTIFS($A$2:$A, A2, $B$2:$B, B2). Anything above 1 is a duplicate row. To delete the extra copies, run Remove duplicates with only those columns ticked. - A value repeated anywhere in columns B to D: count it in the whole block with COUNTIF, for example the conditional formatting rule
=AND(B2<>"", COUNTIF($B$2:$D, B2)>1)applied to B2:D. To list the repeated values, use=ARRAYFORMULA(LET(u, UNIQUE(LOWER(TOCOL(B2:D, 1))), FILTER(u, COUNTIF(B2:D, u)>1))).
Part 1: rows that match on two or more columns
The example
A class attendance log. Someone should sign in once per day, so a duplicate is the same Name on the same Date, whatever the session. The last column shows the COUNTIFS result for each row; the ticked rows are duplicates.
| Row | A: Name | B: Date | C: Session | COUNTIFS of Name + Date |
|---|---|---|---|---|
| 2 | Ana Ruiz | 11/2/2026 | Yoga | 2 ✔ |
| 3 | Ben Cho | 11/2/2026 | Spin | 2 ✔ |
| 4 | ana ruiz | 11/2/2026 | Yoga | 2 ✔ |
| 5 | Ben Cho | 11/3/2026 | Spin | 1 |
| 6 | Cara Diaz | 11/3/2026 | Yoga | 1 |
| 7 | Ben Cho | 11/2/2026 | Yoga | 2 ✔ |
Rows 2 and 4 are the same person on 11/2 (COUNTIFS, like COUNTIF, ignores letter case, so ana ruiz matches Ana Ruiz), and rows 3 and 7 are Ben Cho twice on 11/2. Ben Cho on 11/3 is fine. If you counted the name alone, all three Ben rows would look like duplicates; if you also required the same Session, rows 3 and 7 (Spin vs Yoga) would no longer match. Choosing the columns is the definition of a duplicate.
Count each row’s combination
Put this in D2 and fill it down. Each range is locked with $ and each criterion is the same row’s value:
=COUNTIFS($A$2:$A, A2, $B$2:$B, B2)
Or fill the whole column at once from D2:
=ARRAYFORMULA(IF(A2:A="", "", COUNTIFS(A2:A, A2:A, B2:B, B2:B)))
Add a range/criterion pair for every extra column that has to match, for example , $C$2:$C, C2 for the session. Google’s COUNTIFS help describes it as a count that depends on multiple criteria, and every range must be the same size.
Highlight the duplicate rows
- Select A2:C (the whole table without the header).
- Choose Format › Conditional formatting.
- Under Format rules, open Format cells if… and choose Custom formula is.
- Enter the formula below, pick a fill color under Formatting style, and click Done.
=AND($A2<>"", COUNTIFS($A$2:$A, $A2, $B$2:$B, $B2)>1)
The column letters are locked ($A2, $B2) so every cell in a row is colored by that row’s Name and Date; the row number is not locked, so it moves down with each row. On the example rows 2, 3, 4 and 7 light up. More variations, including coloring only the later copies, are in the highlight duplicates guide.
Show them, or keep one row per combination, with a formula
To list every duplicate row on its own (nothing is changed), enter this in an empty area or a new tab:
=FILTER(A2:C, A2:A<>"", COUNTIFS(A2:A, A2:A, B2:B, B2:B)>1)
To get a clean copy that keeps the first row of each Name + Date and drops the rest, add a running count that only looks at the rows above:
=FILTER(A2:C, A2:A<>"", COUNTIFS(A2:A, A2:A, B2:B, B2:B, ROW(A2:A), "<="&ROW(A2:A))=1)
On the example it returns rows 2, 3, 5 and 6, and leaves out rows 4 and 7. Show only duplicates explains the running-count trick in detail.
Delete the extra rows with Remove duplicates
- Make a copy first if you might want the rows back: right-click the tab and choose Duplicate.
- Select the table, including the header row.
- Choose Data › Data cleanup › Remove duplicates.
- Tick Data has header row.
- Choose which columns decide what counts as a duplicate: tick only Name and Date. Then click Remove duplicates.
A row is removed only when all the ticked columns match an earlier row, and the first copy stays. On the example rows 4 and 7 are removed and four rows remain, the same as the formula above. Google’s Remove duplicates help notes it treats values that differ only in letter case as duplicates. To keep the newest row instead of the first, see keep the latest row; to combine the copies instead of deleting them, see merge duplicate rows.
Why not join the columns into one key?
A common shortcut is a helper column such as =A2&B2 and then a one-column duplicate check. It works until two different rows join into the same text: AB + 12 and A + B12 both become AB12. If you want a key column (it’s handy for VLOOKUP or a pivot table), put a separator that never appears in the data between the parts:
=A2&"|"&B2
Also note that a date joined with & turns into its serial number (11/2/2026 becomes 46328), which is fine for matching but confusing to read. COUNTIFS avoids both problems because it compares each column separately.
Part 2: values repeated anywhere in a block of columns
The example
A teacher’s project groups: one row per group, students in columns B to D. Nobody should be in two groups, and nobody should be listed twice in the same group. The bold names are the duplicates.
| Row | A: Group | B: Student 1 | C: Student 2 | D: Student 3 |
|---|---|---|---|---|
| 2 | Group 1 | Ana | Ben | Cara |
| 3 | Group 2 | Dev | ana | Eli |
| 4 | Group 3 | Finn | Gus | Dev |
| 5 | Group 4 | Hana | Ivy | Hana |
| 6 | Group 5 | Jo | Ben |
Remove duplicates can’t help here: it compares whole rows, and no two groups have the same three students, so it would remove nothing. Ana (B2 and C3), Ben (C2 and C6) and Dev (B3 and D4) are in two groups each, and Hana is listed twice inside Group 4. That’s 14 names in total, 10 different people, so 4 cells are extra copies.
Highlight a value that appears anywhere in the block
Select B2:D, choose Format › Conditional formatting, choose Custom formula is, and enter:
=AND(B2<>"", COUNTIF($B$2:$D, B2)>1)
The difference from Part 1 is the range: $B$2:$D is the whole block, locked in both directions, and B2 has no $ at all, so conditional formatting moves it to each cell in turn (C2, D2, B3 and so on). B2<>"" stops empty cells (like D6) from being counted as duplicates of each other. On the example 8 cells light up: both copies of Ana/ana, Ben, Dev and Hana.
Choose the scope with the $ signs
The same COUNTIF rule catches different duplicates depending on which part of the range you lock. Each of these is applied to B2:D:
| What you want to catch | Rule for B2:D (Custom formula is) | On the example |
|---|---|---|
| A value anywhere in the block | =AND(B2<>"", COUNTIF($B$2:$D, B2)>1) | 8 cells: both Ana/ana, both Ben, both Dev, both Hana |
| Only the second and later copies | =AND(B2<>"", COUNTIF($B$1:$D1, B2)+COUNTIF($B2:B2, B2)>1) | 4 cells: C3 (ana), D4 (Dev), D5 (Hana), C6 (Ben) |
| Repeats inside the same row | =AND(B2<>"", COUNTIF($B2:$D2, B2)>1) | B5 and D5 (Hana twice in Group 4) |
| Repeats inside the same column | =AND(B2<>"", COUNTIF(B$2:B, B2)>1) | C2 and C6 (Ben in Student 2 twice) |
The “later copies” rule reads the block like a page, left to right and then down: it counts the value in all the rows above ($B$1:$D1, which starts at the header row) plus the cells to its left in the same row ($B2:B2). The first copy stays uncolored, so the colored cells are exactly the ones to fix. If your headers could equal a data value, start the first range at a blank row instead.
For a TRUE/FALSE flag per row (“does this group list someone twice?”), put this in E2 and fill it down; only Group 4 shows TRUE:
=SUMPRODUCT((B2:D2<>"")*(COUNTIF(B2:D2, B2:D2)>1))>0
List the values that repeat
To get each repeated value once, turn the block into one column with TOCOL and keep the values COUNTIF finds more than once:
=ARRAYFORMULA(LET(u, UNIQUE(LOWER(TOCOL(B2:D, 1))), FILTER(u, COUNTIF(B2:D, u)>1)))
- TOCOL(B2:D, 1) stacks the block into a single column, reading by row, and the
1skips blank cells (Google’s TOCOL help). - LOWER matters because UNIQUE is case-sensitive (Google’s UNIQUE help) while COUNTIF is not. Without it you’d get both Ana and ana in the list.
- COUNTIF(B2:D, u) counts each distinct value in the original block.
On the example it returns ana, ben, dev and hana, in lowercase. For a table with the count next to each value, most frequent first:
=ARRAYFORMULA(LET(u, UNIQUE(LOWER(TOCOL(B2:D, 1))), n, COUNTIF(B2:D, u), SORT(FILTER(HSTACK(u, n), n>1), 2, FALSE)))
Find where each repeated value is
With the list in F2:F, this formula in G2 (filled down) names every group that contains the value in F2:
=TEXTJOIN(", ", TRUE, FILTER($A$2:$A, BYROW($B$2:$D, LAMBDA(r, SUMPRODUCT(--(r=F2))))>0))
BYROW checks one row of B:D at a time, and the = comparison ignores letter case like COUNTIF but treats * and ? as ordinary characters. On the example: ana → Group 1, Group 2; ben → Group 1, Group 5; dev → Group 2, Group 3; hana → Group 4.
Count the extra copies
Total entries minus different entries gives the number of cells you’d have to clear:
=ARRAYFORMULA(COUNTA(B2:D) - COUNTUNIQUE(LOWER(TOCOL(B2:D, 1))))
Here that’s 14 − 10 = 4, the same four cells the “later copies” rule colors. COUNTUNIQUE on its own is case-sensitive, which is why the values are lowercased first. Counting duplicates explains why different “how many duplicates” numbers disagree.
Make a cleaned copy
If you just need one list of everyone, without the grid, this gives each value once (in lowercase):
=ARRAYFORMULA(UNIQUE(LOWER(TOCOL(B2:D, 1))))
To keep the grid and blank out only the later copies, use MAKEARRAY with a fixed range that covers your data (here B2:D6), on a new tab or to the right of the data:
=LET(g, B2:D6, n, COLUMNS(g), f, TOCOL(g), MAKEARRAY(ROWS(g), n, LAMBDA(i, j, LET(v, INDEX(g, i, j), IF(v="", "", IF(SUMPRODUCT(--(ARRAY_CONSTRAIN(f, (i-1)*n+j, 1)=v))>1, "", v))))))
For each cell it looks at everything before it in reading order (TOCOL scans by row by default) and returns an empty cell if the value already appeared. On the example C3, D4, D5 and C6 come back empty and the 10 remaining names have no repeats. To replace the original, right-click the tab and choose Duplicate as a backup, copy the result, select B2 and use Edit › Paste special › Values only. Usually, though, a duplicate in a grid like this is a decision (which group should Ana be in?), so highlighting and fixing by hand is the safer route.
The same value on another tab
To also flag students already placed on a tab named Week 2, apply this to B2:D. Conditional formatting can’t refer to another tab directly, so the range goes in INDIRECT as text:
=AND(B2<>"", COUNTIF(INDIRECT("'Week 2'!B2:D"), B2)>0)
Comparing lists between tabs and files is covered in the compare two columns or sheets guide, and stacking several tabs into one list in combine lists without duplicates.
Pitfalls
- Everything lights up, or nothing does. The $ signs are wrong. In Part 1 lock the column letters (
$A2); in Part 2 lock the whole range ($B$2:$D) and leave the cell (B2) unlocked. The cell in the formula must be the top-left cell of the range you selected. - Empty cells counted as duplicates. Keep the
B2<>""(or$A2<>"") part; blank cells match each other otherwise. - Values that look the same don’t match. COUNTIF and COUNTIFS ignore letter case but not spaces, so Ben and Ben␣ are different. Run Data › Data cleanup › Trim whitespace on the block first. For Gmail dots, phone formats and typos, see duplicates that don’t match exactly.
- Values that aren’t the same do match. COUNTIF reads
*and?in a value as wildcards, so a code like A* also counts Ab and Ac. Use~*in the criterion, or compare with=as in the BYROW formula (Google’s COUNTIF help). - Numbers and text. A code typed as a number in one cell and as text in another (for example an ID with a leading apostrophe) may not match. Keep each column in one format.
- #REF! from the list formulas. They spill down (and the table formula to the right); clear the cells in the way or move the formula to a new tab.
- #N/A “No matches are found in FILTER evaluation”. Nothing repeats. Wrap the formula in
IFERROR(…, "No duplicates"). - Slow sheets. Open ranges like
B2:Dare convenient; on very large sheets, use a fixed range such asB2:D2000in the BYROW and MAKEARRAY formulas.
FAQ
How do I find duplicates across multiple columns in Google Sheets?
First decide what “duplicate” means. If a row only counts as a duplicate when two or more columns match (same name and same date), use COUNTIFS with one range/criterion pair per column, for example =COUNTIFS($A$2:$A, A2, $B$2:$B, B2) in a helper column, or the conditional formatting rule =AND($A2<>"", COUNTIFS($A$2:$A, $A2, $B$2:$B, $B2)>1). If a value counts as a duplicate when it appears anywhere in a block of columns (the same student in two groups), count it in the whole block: apply =AND(B2<>"", COUNTIF($B$2:$D, B2)>1) to B2:D.
Can Remove duplicates check several columns at once?
Yes, for whole rows. In Data › Data cleanup › Remove duplicates, tick only the columns that define a duplicate, for example Name and Date; a row is removed when all ticked columns match an earlier row, and the first copy is kept. It can’t find the same value spread over different columns, because it compares rows with rows, not cells with cells. For that, use COUNTIF on the whole range or list the values with UNIQUE(TOCOL(…)).
How do I highlight a value that appears anywhere in columns B to D?
Select B2:D, choose Format › Conditional formatting, choose Custom formula is and enter =AND(B2<>"", COUNTIF($B$2:$D, B2)>1). The range is locked with $ and the cell (B2) is not, so each cell is checked against the whole block. To color only the second and later copies, reading row by row, use =AND(B2<>"", COUNTIF($B$1:$D1, B2)+COUNTIF($B2:B2, B2)>1).
How do I list the values that repeat across several columns?
Turn the block into one column with TOCOL, then keep the values that COUNTIF finds more than once: =ARRAYFORMULA(LET(u, UNIQUE(LOWER(TOCOL(B2:D, 1))), FILTER(u, COUNTIF(B2:D, u)>1))). TOCOL with 1 skips blank cells, and LOWER makes Ana and ana one entry, because UNIQUE is case-sensitive while COUNTIF is not.
Why shouldn’t I just join the columns into one key?
A joined key such as =A2&B2 can make different rows look the same: AB with 12 and A with B12 both become AB12. If you use a key column, put a separator that never appears in your data between the parts, such as =A2&"|"&B2, or skip the key and use COUNTIFS, which compares each column separately.
How do I check for duplicates within the same row only?
Apply =AND(B2<>"", COUNTIF($B2:$D2, B2)>1) to B2:D. Locking only the columns ($B2:$D2) keeps the count inside each row. For a TRUE/FALSE flag per row, enter =SUMPRODUCT((B2:D2<>"")*(COUNTIF(B2:D2, B2:D2)>1))>0 next to the row and fill it down.
Install free from Google Workspace MarketplaceSee SheetDupes
Want to test it first? Try it on sample data (makes a copy of a 12-row example sheet in your Drive).
Related guides
- How to Find and Remove Duplicates in Google Sheets: Highlight, Count, Delete and Keep the Original (2026)
- How to Highlight Duplicates in Google Sheets: Conditional Formatting Formulas for One Column, Whole Rows, Repeats Only and Two Sheets (2026)
- How to Compare Two Columns or Two Sheets in Google Sheets to Find Matches and Duplicates (2026)
- Duplicates That Don’t Match Exactly in Google Sheets: Case, Extra Spaces, Gmail Dots, Phone Formats and Typos (2026)
- How to Remove Duplicates in Google Sheets but Keep the Latest, First or Highest Row per Key (2026)
- How to Prevent Duplicate Entries in Google Sheets: Data Validation Rules, Warnings and a Small Script (2026)
- How to Count Duplicates in Google Sheets: per Value, Extra Rows, Unique Counts and Why the Numbers Disagree (2026)
- How to Combine Two Lists or Several Tabs in Google Sheets Without Duplicates: VSTACK, UNIQUE, One Row per Key and Other Files (2026)
- How to Merge Duplicate Rows in Google Sheets: Sum the Numbers, Join the Notes and Fill the Blanks (2026)
- UNIQUE vs Remove Duplicates in Google Sheets: Live or Static, Letter Case, Spaces, Columns and Headers (2026)
- How to Remove Duplicates Within a Cell in Google Sheets: Comma-Separated Lists, Tags, Line Breaks and Letter Case (2026)
- How to Show Only the Duplicates in Google Sheets: Filter Duplicate Rows, List Repeated Values and Find Rows That Appear Once (2026)
- How to Remove Duplicates Automatically in Google Sheets: Apps Script on a Daily Timer, on Form Submit or From a Menu (2026)
- How to Find Duplicates in Google Sheets but Ignore Blank Cells: Highlight, Count, List and Remove Without Empty Rows Getting in the Way (2026)
- How to Find Duplicate Transactions in Google Sheets: Double-Imported Rows, Invoices Paid Twice and Same-Amount Charges Within a Few Days (2026)
- How to Format Phone Numbers in Google Sheets: Strip Dashes and Spaces, Show (555) 010-1234, Handle +1 and Extensions, Then Find Duplicate Contacts (2026)
- How to Change Text Case in Google Sheets: UPPERCASE, lowercase, Proper Case Names, Sentence Case and Duplicates That Differ Only in Case (2026)