To check whether one row equals another in Excel, use a single IF formula that compares the two rows with an array comparison: =IF(AND(A2:E2=A1:E1),"Match","No match") entered as a normal formula in Excel 365 and Excel 2021+, or confirmed with Ctrl+Shift+Enter in older versions. Excel compares every cell in the two ranges at once and the AND collapses the results into one TRUE/FALSE, so the IF returns a single answer for the whole row. If you need to know how many cells differ, use =SUMPRODUCT(--(A2:E2<>A1:E2)) instead, which counts mismatches across the row.

That is the short answer. The rest of this guide covers the working setup, the exact formulas for each common variant, and the traps that make row comparisons return the wrong answer.

What You'll Need

  • Excel 2016 or later, or Microsoft 365. Excel for the web also supports the dynamic array comparison described below.
  • Two rows of data laid out the same way: the same number of columns in the same order. A comparison only works if column D means the same thing in both rows.
  • A helper column (or a spare cell) to hold the formula. Comparing whole rows means one result per row, not one result per cell.
  • Clean data. Extra spaces, mixed text and number types, and hidden characters are the usual reason two rows that look identical compare as different.

Step-by-Step

  1. Lay out the data so rows are comparable. Put the two records you want to compare side by side in the same columns, for example row 1 and row 2 both holding Name in A, Date in B, Amount in C, and Status in D. If one row has extra leading or trailing columns, the ranged comparison will be misaligned and give nonsense.
  2. Pick a cell for the result. A helper column to the right of your data is cleanest. Click the cell in that column on the row you are evaluating, for example F2 if your data runs A2:D2.
  3. Write the row-level IF formula. Type =IF(AND(A2:D2=A1:D1),"Match","No match"). This says: if every cell in A2:D2 equals the corresponding cell in A1:D1, show Match, otherwise show No match. Replace the ranges with your real columns and rows. Note that the two ranges must be the same size and shape.
  4. Confirm the formula correctly. In Microsoft 365, Excel 2021, and Excel for the web, press Enter. In Excel 2019 and older, the array comparison may need Ctrl+Shift+Enter, which wraps the formula in braces. If you press Enter in an older version and get a single result that looks wrong or a #VALUE! error, edit the cell and re-enter it with Ctrl+Shift+Enter.
  5. Read the result. A TRUE condition returns your Match text; otherwise you get No match. Because AND is inside IF, you get one verdict per row pair, which is what most people actually want.
  6. Copy the formula down. Drag the fill handle down the helper column. If you are comparing row 3 to row 2, row 4 to row 3, and so on, write relative references (A3:D3=A2:D2) so each row compares to the one above it. If every row should compare to one fixed reference row, lock that row with dollar signs: =IF(AND(A3:D3=$A$1:$D$1),"Match","No match").
  7. Get a count of differences instead of a yes/no. When you need to know how far apart two rows are, use =SUMPRODUCT(--(A2:D2<>A1:D1)). This returns the number of cells that do not match. A result of 0 means the rows are identical; 2 means two cells differ. SUMPRODUCT works without Ctrl+Shift+Enter in every version, which makes it the safer choice for older files.
  8. Return the differing values if you need them. To flag which column differs, place a per-cell check in each column, such as =IF(A2<>A1,"Differs",""), and copy it across the row. Combine with a heading row so you can see the column name. This is more work than the single row formula but tells you where the problem is, not just that there is one.
  9. Convert the result to a filterable value. If you want to filter or sort by matches, wrap the output in a text value (as above) rather than leaving TRUE/FALSE, or apply a filter on the helper column. Text values are easier to read in a printed sheet and export more predictably.
  10. Verify with a manual spot check. Pick one row that returned Match and one that returned No match, and compare them by eye or with a quick sort. If a row you know is identical returns No match, move to the troubleshooting section: the cause is almost always data type or invisible characters.

Common Mistakes

Comparing ranges of different sizes. A2:D2 compared to A1:E1 will not behave the way you expect. Excel needs matching dimensions; if one row has a different number of populated columns, the comparison either errors or silently mismatches at the edges.

Forgetting absolute references for a fixed row. If you compare every row to row 1, write $A$1:$D$1. Without the dollar signs, the reference slides down as you copy and each row ends up comparing to a different row, which produces results that look random.

Mixing text and numbers that look the same. A number stored as text (often left-aligned, or imported from a CSV) does not equal the same digits stored as a number. "123" and 123 are different values to Excel. The row comparison will say No match even though the cells look identical on screen.

Trailing spaces and non-breaking spaces. A trailing space in one cell, or a non-breaking space pasted in from a web page, makes two strings unequal. Use TRIM to strip regular spaces: =IF(AND(TRIM(A2:D2)=TRIM(A1:D1)),"Match","No match"). TRIM does not remove non-breaking spaces, so if the problem persists, replace CHAR(160) using Find and Replace.

Case sensitivity surprises. The equals sign in Excel ignores case: "apple" equals "Apple". If case matters, use EXACT per cell: =IF(AND(EXACT(A2:D2,A1:D1)),"Match","No match"), again confirmed with Ctrl+Shift+Enter on older versions.

Comparing formatted vs unformatted dates. A date formatted as text after an import is not the same as a real date serial number. Both may display as 01/02/2026 but compare as unequal. Check alignment: real dates sit right-aligned by default.

Treating the array comparison as if it returns one value per cell. A2:D2=A1:D1 evaluated on its own returns an array of TRUE/FALSE values, one per column. Wrapping it in AND collapses it to one result. Without AND you may see a spilled array or an unexpected single result depending on where the formula sits.

Tips

Use a helper column name that says what the result means, such as RowMatches or DiffCount, so the sheet stays readable months later.

If you compare many rows, add a totals line under the helper column with COUNTIF to get the number of matches: =COUNTIF(F2:F100,"Match").

For a quick visual check, use conditional formatting on the helper column to highlight "No match" cells in red so problem rows jump out.

Power Query is the more robust route for regular comparisons of two imported datasets. Merge the tables on a key column and let Query show you matching and non-matching rows, which avoids formula drift entirely.

Keep the two rows in the same workbook, on the same sheet if possible. Cross-sheet references work fine, but sheet names with spaces need apostrophes, and it is easy to point a formula at the wrong sheet.

When data comes from an export, run TRIM and VALUE or Text to Columns on the date column before comparing. Ten minutes of cleaning prevents most false No match results.

Troubleshooting

If you get #VALUE!, the most likely cause is an array formula entered without Ctrl+Shift+Enter in an older version of Excel, or ranges that are different sizes. Re-enter the formula with Ctrl+Shift+Enter and check the range dimensions.

If a row you know is identical returns No match, compare the two cells individually with a simple equals test, such as =A2=A1 for each column. The one that returns FALSE is your culprit. Then check for trailing spaces, text-formatted numbers, and non-breaking spaces.

If the result is correct in the first cell but wrong after copying, the references are the problem. Decide whether the comparison is row-to-row or row-to-a-fixed-row, and use dollar signs accordingly.

If the formula returns a spilled array across several columns, your Excel version supports dynamic arrays and you left the formula without the AND wrapper. Add AND or wrap in IF to get a single result.

If conditional formatting or filtering treats the helper column oddly, it may contain TRUE/FALSE rather than text. Convert it with the IF formula's text outputs, or filter using the boolean values directly, since Excel can filter on TRUE/FALSE.

If the workbook is slow on thousands of rows, the array comparison is the likely cost. Replace the whole-row AND with SUMPRODUCT of the mismatch count, or move the check into Power Query, which handles large comparisons far better.

Frequently Asked Questions

Can I compare two entire rows in one formula without a helper column?

Yes. Place =IF(AND(A2:D2=A1:D1),"Match","No match") in any spare cell. The helper column is only a convenience so you can copy one formula down a whole dataset.

Does Excel's equals operator care about upper and lower case?

No. "Apple" equals "apple" in a normal comparison. Use EXACT inside the AND if case must match.

How do I count how many cells differ between two rows?

Use =SUMPRODUCT(--(A2:D2<>A1:D1)). It returns the number of mismatched cells and does not need Ctrl+Shift+Enter in any version.

Why does my formula say No match when the cells look identical?

Usually trailing spaces, a number stored as text, a date stored as text, or a non-breaking space from a web copy. Test each column with a simple equals formula to find the offender.

Can I compare rows on two different sheets?

Yes. Reference them with the sheet name, for example =IF(AND(Sheet1!A2:D2=Sheet2!A2:D2),"Match","No match"). Put apostrophes around sheet names that contain spaces.

What is the difference between comparing rows with AND and with SUMPRODUCT?

AND gives a single yes/no verdict for the whole row, while SUMPRODUCT gives a count of differing cells. Use AND for a Match/No match label and SUMPRODUCT when you need to know how many values changed.