How to Compare Two Columns in Google Sheets

To compare two columns in Google Sheets, you can use various methods such as conditional formatting, the IF function, or the FILTER function. Here's how you can use these methods to compare two columns:

Conditional Formatting

  1. Open your Google Sheet.
  2. Select the range that you want to compare. For example, if you have data in columns A and B, select the range A1:B10.
  3. Click on "Format" in the menu, and then select "Conditional formatting."
  4. In the Conditional format rules sidebar, choose the "Format cells if" dropdown and select "Custom formula is."
  5. In the "Value or formula" input box, type the following formula: =A1<>B1 (Replace 'A1' and 'B1' with the starting cells of the columns you want to compare).
  6. Choose the formatting style you want to apply to the cells that are different. For example, you can change the background color to red.
  7. Click on "Done."

Now, you'll see that the cells with different values in the two columns are highlighted with the specified formatting.

IF Function

You can use the IF function to compare two columns and show the results in a new column. For example, you can create a column C that will display "Match" if the values in columns A and B are equal, and "Mismatch" if they are not.

  1. Open your Google Sheet.
  2. In cell C1 (or the first cell in the new column), type the following formula: =IF(A1=B1, "Match", "Mismatch") (Replace 'A1' and 'B1' with the cells you want to compare).
  3. Press Enter.
  4. Click on the bottom-right corner of cell C1 and drag it down to copy the formula to the other cells in the column.

The new column will now display "Match" or "Mismatch" based on whether the values in the corresponding cells in columns A and B are equal or not.

FILTER Function

You can use the FILTER function to create a new list that shows only the rows where the values in the two columns are different.

  1. Open your Google Sheet.
  2. In an empty cell (for example, cell D1), type the following formula: =FILTER(A1:B, A1:A<>B1:B) (Replace 'A1:A' and 'B1:B' with the columns you want to compare, and 'A1:B' with the range you want to display).
  3. Press Enter.

This will create a new list in column D that shows only the rows where the values in columns A and B are different.

Example

Let's say we have the following data in columns A and B:

A         B
Apple     Apple
Orange    Banana
Grape     Grape
Mango     Pineapple

To compare these two columns, you can use the IF function as described above:

  1. In cell C1, type the following formula: =IF(A1=B1, "Match", "Mismatch")
  2. Press Enter.
  3. Drag the formula down to the other cells in column C.

The resulting table will look like this:

A         B           C
Apple     Apple       Match
Orange    Banana      Mismatch
Grape     Grape       Match
Mango     Pineapple   Mismatch

Now you can easily see which rows have matching values and which ones have different values in columns A and B.

Did you find this useful?