Compare 2 Consecutive Columns in Excel Row by Row

Need to compare two columns in Excel, row by row? It is one of the most common jobs in data checking, and it is easier than you might think. All you need is the IF function. In this post, we show you how, step by step.

How to compare two columns in Excel for matches or differences

First, write a normal IF formula that compares the first two cells. Type it into a spare column in the same row. Then copy it down the column by dragging the fill handle. That is the small square in the bottom-right corner of the selected cell. When you point at it, your cursor changes to a plus sign.

Dragging the fill handle to copy an Excel formula down a column

Formula for matches

To find cells in the same row that hold the same content, use this formula. In our example, the cells are A2 and B2.

=IF(A2=B2,”Match”,””)

Formula for differences

To find cells in the same row that are different, swap the “=” for the “not equal” sign.

=IF(A2<>B2,”No match”,””)

Matches and differences together

You can also find both with a single formula. Either of these works:

=IF(A2=B2,”Match”,”No match”)

Or

=IF(A2<>B2,”No match”,”Match”)

Your result may look like this:

Excel sheet showing Match and No match results for two columns

The formula works well with dates, numbers, text and times.

A handy tip

Excel does not mind capital letters here. “Apple” and “apple” count as a match. If you need the capitals to match too, ask us and we will show you another formula. Stuck with a big spreadsheet? Chat to the friendly NETCONFIG team, and we will keep it simple.