# 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

- Open your Google Sheet.
- Select the range that you want to compare. For example, if you have data in columns A and B, select the range A1:B10.
- Click on "Format" in the menu, and then select "Conditional formatting."
- In the Conditional format rules sidebar, choose the "Format cells if" dropdown and select "Custom formula is."
- 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). - Choose the formatting style you want to apply to the cells that are different. For example, you can change the background color to red.
- 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.

- Open your Google Sheet.
- 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). - Press Enter.
- 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.

- Open your Google Sheet.
- 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). - 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:

- In cell C1, type the following formula:
`=IF(A1=B1, "Match", "Mismatch")`

- Press Enter.
- 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.