How to compare two columns in Google Sheets (With Examples)

Comparing two columns in Google Sheets is a simple process that can be done using the IF and VLOOKUP functions. The IF function can be used to compare two columns to determine if they are identical or if one is greater than or less than the other. The VLOOKUP function can be used to compare two columns and return a third value based on the comparison result. Both of these functions can be used together to compare two columns and return a value based on the comparison result. Examples of how to use the IF and VLOOKUP functions to compare two columns in Google Sheets are provided.


Often you may want to compare two columns in Google Sheets to look for similarities and differences.

The following examples show how to make the following comparisons between two columns:

1. Compare Two Columns to Find Which Values are Equal

2. Compare Two Columns to Find Which Values are Greater / Less Than

3. Compare Two Columns to Find Which Values Belong to Both Columns

Example 1: Find Which Values are Equal

We can use the following syntax to compare values across two columns and find which values are equal:

=IF(A1=B1, "Yes", "No")

The following screenshot shows how to use this syntax in practice:

This allows us to quickly see which values match in each row between the two columns.

Example 2: Find Which Values are Greater & Less Than

We can use the following syntax to compare values across two columns and find which values are greater:

=IF(A1>B1, "Team 1", "Team 2")

The following screenshot shows how to use this syntax in practice:

This allows us to quickly see which team scored more points in each row.

Example 3: Find Which Values Belong to Both Columns

Suppose we have the following two columns and we want to find which values in column B also belong to column A:

We can use Conditional formatting to accomplish this.

First, highlight cells B2:B13. Then click the Format tab and then click Conditional formatting:

In the Conditional format rules panel that appears on the right side of the screen, click the dropdown menu next to Format cells if… and scroll to the bottom of the list and click Custom formula is.

Then enter the following formula:

=COUNTIF($A$2:$A$13,B2)>0

Once you click Done, the conditional formatting will be applied to column B:

Notice that each value in column B that also appears in column A is highlighted.

Note that you can also change the color used for highlighting in the Conditional format rules panel.

For example, we could change the highlighting color to orange:

The following tutorials explain how to perform other common operations in Google Sheets:

How to Use SUMIF with Multiple Columns in Google Sheets

x