When working with large Excel spreadsheets, comparing the data from two columns can be time-consuming. Instead of analyzing the columns and writing “Match” or “Mismatch” into a separate column, you can use Excel’s functions to streamline the process.
We’ll take a look at how to use different Excel functions to compare two columns and identify matching or mismatching data.
1. How to Highlight Duplicate Data
If you want to compare two columns in Excel, but don’t want to add a third column showing if the data exists in both columns, you can use the Conditional formatting feature.
- Select the data cells you want to compare.
- Head to the Home tab.
- From the Styles group, open the Conditional Formatting menu.
- Click Highlight Cells Rules > Duplicate Values.
- Click OK.
Excel will now highlight the names that are present in both columns.
2. How to Highlight Unique Data
You can use the same function if you want to identify data that isn’t part of both columns.
- Select the data set.
- Once again, head to Home > Conditional Formatting > Highlight Cells Rules > Duplicate Values.
- For Format cells that contain, choose Unique.
- Select how the mismatched data should be highlighted and click OK.
Excel will now highlight the names that can be found only in one of the two columns.
3. Highlight Rows With Identical Data
If you need a better visual representation of identical data, you can make Excel find matching values in two columns and highlight the rows with matching data. As we did on the previous method, we’ll use the Conditional formatting feature, but will add a few extra steps.
This way, you will have a visual indicator that will help you identify matching data faster than reading through a separate column. Follow these steps to use Excel’s conditional formatting to compare two sets of data:
- Select the data you want to compare (don’t include the headers) and open the Home tab.
- Click Conditional Formatting and select New Rule.
- From Select a Rule Type, click Use a formula to determine which cells to format.
- Enter =$A2=$B2 into the field below Format values where this formula is true. Here, A and B correspond to the two columns we are comparing. 5. To customize how Excel will highlight the rows, click Format, and in the Format cells window, select the Fill tab. You can choose the background color, pattern style, and pattern color. You will get a sample, so you can preview the design. Click OK once you’ve completed the customization process.
- Click OK in the New Formatting Rule window, so Excel will highlight the rows with matching data instantly.
You can add a new column when comparing two Excel columns. Using this method, you will add a third column that will display TRUE if the data matches and FALSE if the data doesn’t match.
For the third column, use the =A2=B2 formula to compare the first two columns. If you think your spreadsheet will look too crowded with the TRUE and FALSE rows, you can set a filter in Excel, so it will only show the TRUE values.
A different method to analyze Excel data from two columns is to use an IF function. This is similar to the above method, but it comes with the advantage that you can customize the displayed value.
Instead of having the TRUE or FALSE values, you can set the value for matching or different data. For this example, we’ll use the Data matches and Data doesn’t match values.
The formula we’ll use for the column showing the results is =IF(A2=B2,"Data Matches","Data Doesn’t Match").
6. Compare Two Columns With a VLOOKUP Function and Find Matching Data
Another way to have Excel find duplicates in two columns is to use a VLOOKUP function. Excel will compare each cell in the second column against the cells in the first column.
Use the =VLOOKUP(B2,$A$2:$A$14,1,0) for the column displaying the results. Just make sure you adjust the data range.
So to avoid any confusion, upgrade the VLOOKUP function to an IFERROR function. If you need to find data that is in column B and is also in column A, use the =IFERROR(VLOOKUP(B2,$A$2:$A$14,1,0),"Data Doesn't Match") formula.
This is just an example of a VLOOKUP function that you could use to search spreadsheets efficiently.
Besides comparing two Excel columns for matches, you can also use the VLOOKUP function to extract matching data. This will save you time as you don’t have to manually go through the first column and search for relevant data.
Also, if data in the second column misses from the first column, Excel will display a #N/A value. For this, use the =VLOOKUP(D2,$A$2:$B$14,2,0) formula.
Compare Excel Columns With Ease
As we’ve discussed, there are plenty of ways and tricks you can use
to compare two columns in an Excel spreadsheet and get the best results.
You can even add a third column to display the results. You can even
use Excel to compare physical documents, as you can quickly import data
in Excel with its built-in tools.
Source: https://www.makeuseof.com/search/?q=How+to+Compare+Two+Columns+in+Excel%3A+7+Methods