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

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.

RowA: NameB: DateC: SessionCOUNTIFS of Name + Date
2Ana Ruiz11/2/2026Yoga2 ✔
3Ben Cho11/2/2026Spin2 ✔
4ana ruiz11/2/2026Yoga2 ✔
5Ben Cho11/3/2026Spin1
6Cara Diaz11/3/2026Yoga1
7Ben Cho11/2/2026Yoga2 ✔

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

  1. Select A2:C (the whole table without the header).
  2. Choose Format › Conditional formatting.
  3. Under Format rules, open Format cells if… and choose Custom formula is.
  4. 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

  1. Make a copy first if you might want the rows back: right-click the tab and choose Duplicate.
  2. Select the table, including the header row.
  3. Choose Data › Data cleanup › Remove duplicates.
  4. Tick Data has header row.
  5. 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.

RowA: GroupB: Student 1C: Student 2D: Student 3
2Group 1AnaBenCara
3Group 2DevanaEli
4Group 3FinnGusDev
5Group 4HanaIvyHana
6Group 5JoBen

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 catchRule 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)))

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

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.

Duplicate rows defined by several columns, without the formulas? SheetDupes (disclosure: we make it) is a Google Sheets add-on for duplicate rows. Tick the columns that define a duplicate in the sidebar, for example Name and Date, and preview the matching groups, then highlight the extra rows without changing any values, and only then remove them or merge each group into one row. It copies a backup tab before it removes or merges anything, ignores extra spaces and, optionally, letter case and punctuation. It compares rows, so for names scattered across a block of columns (Part 2) the formulas above are the right tool. Preview and Highlight are free on any size sheet; there is a 14-day free trial with no credit card, and writes remain free after the trial on sheets with up to 2,000 data rows during launch (through Jan 31, 2027; 500 after that). It only reads and writes the spreadsheet you have open, and your data is not sent to Loomwise. It is live on the Google Workspace Marketplace.
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