Google Sheets is one of the most powerful tools for working with structured data online. Whether you’re managing sales records, customer lists, student data, or project logs, it's common to encounter the need to find matching rows — that is, rows with the same or similar values across one or more columns.
In this blog, we’ll explore different methods to find matching rows in Google Spreadsheets, using built-in functions like FILTER, QUERY, COUNTIF, ARRAYFORMULA, and conditional formatting. These techniques will help you identify duplicates, compare lists, highlight matches, or clean your data efficiently.
Before diving into the methods, let’s understand where matching rows are typically useful:
Detecting duplicate entries (e.g., customer names, email addresses)
Finding common data between two lists
Identifying repeated transactions or errors
Merging datasets with matching keys
Tracking overlapping appointments or schedules
COUNTIF is a simple yet powerful function to count how many times a particular value appears in a range.
Suppose you have the following list in column A (names):
A
1 Name
2 Alice
3 Bob
4 Alice
5 Charlie
6 Bob
To find how many times each name appears:
B
1 Count
2 =COUNTIF(A:A, A2)
3 =COUNTIF(A:A, A3)
4 =COUNTIF(A:A, A4)
5 =COUNTIF(A:A, A5)
6 =COUNTIF(A:A, A6)
You’ll get:
B2: 2
B3: 2
B4: 2
B5: 1
B6: 2
Now you can filter or highlight rows where the count is greater than 1 to identify duplicates.
You can use FILTER to extract only rows that have matching values.
A B
1 Name Department
2 Alice Sales
3 Bob HR
4 Alice Sales
5 Charlie Tech
6 Bob HR
To find rows that occur more than once based on the combination of name and department:
=FILTER(A2:B, COUNTIFS(A2:A, A2:A, B2:B, B2:B) > 1)
This formula returns only the rows where the same name and department appear more than once.
The QUERY function allows SQL-like filtering and grouping in Google Sheets.
=QUERY(A1:B, "SELECT A, B, COUNT(A) WHERE A IS NOT NULL GROUP BY A, B HAVING COUNT(A) > 1", 1)
This will display only the name and department combinations that appear more than once along with their count.
Conditional formatting visually highlights duplicate or matching rows.
Select the range you want to check (e.g., A2:A100).
Go to Format > Conditional formatting.
Under Format cells if, choose Custom formula is.
Enter:
=COUNTIF(A:A, A2) > 1
Choose a background color.
Click Done.
Now, any matching names will be highlighted.
To highlight rows based on two columns (e.g., name and department), use:
=COUNTIFS($A$2:$A, A2, $B$2:$B, B2) > 1
Suppose you have two lists: List A in Column A, and List B in Column B. You want to find which values from A are also in B.
In Column C:
=IF(COUNTIF(B:B, A2), "Match", "")
This formula will label rows in List A that also exist in List B.
To extract only the matching rows:
=FILTER(A2:A, COUNTIF(B:B, A2:A))
This returns only those values from List A that also appear in List B.
Sometimes it helps to reduce the dataset to unique values and then check for duplicates.
=UNIQUE(A2:A)
Then apply COUNTIF on the original data against the UNIQUE output to determine if a value occurs more than once.
If you want to compare entire rows across multiple columns (e.g., name, department, ID):
Combine columns into a single string:
=ARRAYFORMULA(A2:A & "-" & B2:B & "-" & C2:C)
Apply COUNTIF to that concatenated string.
=ARRAYFORMULA(COUNTIF(D2:D, D2:D))
This shows how many times each exact row combination appears.
Finding matching rows in Google Sheets can range from simple one-column matches to complex multi-column comparisons. By using functions like COUNTIF, FILTER, QUERY, and ARRAYFORMULA, you can easily locate duplicates, similarities, and intersections in your data.
Whether you’re cleaning up records, spotting errors, or preparing reports, mastering these techniques will make your spreadsheet workflows more efficient and reliable. Keep experimenting with formulas to fit your specific data structure and analysis needs.