Tip: Other languages are Google-Translated. You can visit the English version of this link.
Log in
x
or
x
x
Register
x

or

How to compare alphanumeric values in two columns in Excel?

If you have two list of alphanumeric text values, and now, you need to compare these two columns and find the duplicate or unique values. Are there any quick methods to solve this problem without check them one by one? In this article, I will talk about some tricks for dealing with this task in Excel.

Compare alphanumeric values in two columns to find the same values

Compare alphanumeric values in two columns to list the different values separately

Compare alphanumeric values in two columns to select or highlight the same or different values


Compare alphanumeric values in two columns to find the same values


Here is a formula can help you to identify the same alphanumeric values both in column A and column B, please do as this:

Enter this formula: =IFERROR(IF(MATCH(B2,$A$2:$A$11,0)>0,"Match"),"") (B2 is the cell which you want to compare with another column, A2:A11 is the data list that you want to be compared with ) into a blank cell beside your data columns, and then drag the fill handle down to the cells that you want to apply this formula, now, you can see, a text “ Match” is displayed next to the corresponding cell if the cell value both in the two columns, see screenshot:

doc compare alphanumeric 1


Compare alphanumeric values in two columns to list the different values separately

To find and list all different strings from the two columns separately, the following VBA code may help you, please do as follows:

1. Hold down the ALT + F11 keys to open the Microsoft Visual Basic for Applications window.

2. Click Insert > Module, and paste the following code in the Module Window.

VBA code: list the different cell values from two columns separately:

Sub Compare()
'UpdatebyExtendoffice 20160623
    Dim I As Long, J As Long, K As Long, M As Long
    Application.ScreenUpdating = False
    J = 1
    K = 1
    M = Cells(Rows.Count, 2).End(xlUp).Row
    Range("D1").Value = "A not in B"
    Range("E1").Value = "B not in A"
    For I = 2 To M
        If IsError(Application.Match(Range("A" & I).Value, Columns("B"), 0)) Then
            J = J + 1
            Range("D" & J).Value = Range("A" & I).Value
        End If
        If IsError(Application.Match(Range("B" & I).Value, Columns("A"), 0)) Then
            K = K + 1
            Range("E" & K).Value = Range("B" & I).Value
        End If
    Next I
    Application.ScreenUpdating = True
End Sub

3. Then press F5 key to run this code, and the different values in the two columns will be listed into column D and column E separately as following screenshot shown:

doc compare alphanumeric 2


Compare alphanumeric values in two columns to select or highlight the same or different values

If you have Kutools for Excel, with its powerful tool-Select Same & Different Cells, you can quickly compare the alphanumeric strings in two columns and find or highlight the same or different values as quickly as possible.

Kutools for Excel : with more than 300 handy Excel add-ins, free to try with no limitation in 60 days. 

After installing Kutools for Excel, please do as follows:

1. Select the two columns separately by holding the Ctrl key, and then click Kutools > Select > Select Same & Different Cells, see screenshot:

doc compare alphanumeric 3

2. In the Select Same & Different Cells dialog box, please do the following operations:

(1.) Check My data has headers if you needn’t compare the two column headers;

(2.) Select Each row under the Based on section;

(3.) Select Same Values if you want to find the cell values both in the two columns under the Find section;

(4.) If you want to highlight the selected cells with a background or font color, please check Fill backcolor or Fill font color under the Processing of result.

doc compare alphanumeric 4

3. After finishing the settings, click Ok button, a prompt box will pop out to remind you how many cells will be selected, at the same time, you can see the same cell values both in column A and column C are highlighted in column A, see screenshot:

doc compare alphanumeric 5

Notes:

1. If you select Different Values in the Compare Ranges dialog box, the values only in column A but not in column C are highlighted as following screenshot shown:

doc compare alphanumeric 6

2. To select or highlight the same or different values in column C, you just need to swap the two columns in the Find values in and According to text boxes as you need.

Click Free Download Kutools for Excel Now!


Demo: Compare alphanumeric values in two columns to select or highlight the same or different values

Kutools for Excel: with more than 200 handy Excel add-ins, free to try with no limitation in 60 days. Download and free trial Now!


Recommended Productivity Tools

Ribbon of Excel (with Kutools for Excel installed)

300+ Advanced Features Increase Your Productivity by 71%, and Help You To Stand Out From Crowd!

Would you like to complete your daily work quickly and perfectly? Kutools For Excel brings 300+ cool and powerful advanced features (Combine workbooks, sum by color, split cell contents, convert date, and so on...) for 1500+ work scenarios, helps you solve 82% Excel problems.

  •  Deal with all complicated tasks in seconds, help to enhance your work ability, get success from the fierce competition, and never worry about being fired.
  •  Save a lot of work time, leave much time for you to love and care the family and enjoy a comfortable life now.
  •  Reduce thousands of keyboard and mouse clicks every day, relieve your tired eyes and hands, and give you a healthy body.
  •  Become an Excel expert in 3 minutes, and get admiring glance from your colleagues or friends.
  •  No longer need to remember any painful formulas and VBA codes, have a relaxing and pleasant mind, give you a thrill you've never had before.
  •  Spend only $39, but worth than $4000 training of others. Being used by 110,000 elites and 300+ well-known companies.
  •  60-day unlimited free trial. 60-day money back guarantee. Free upgrade and support for 2 years. Buy once, use forever.
  •  Change the way you work now, and give you a better life immediately!

Office Tab Brings Efficient And Handy Tabs to Office (include Excel), Just Like Chrome, Firefox, And New IE

  • Increases your productivity by 50% when viewing and editing multiple documents.
  • Reduce hundreds of mouse clicks for you every day, say goodbye to mouse hand.
  • Open and create documents in new tabs of same window, rather than in new windows.
  • Help you work faster and easily stand out from the crowd! One second to switch between dozens of open documents!
Say something here...
symbols left.
You are guest ( Sign Up? )
or post as a guest, but your post won't be published automatically.
Loading comment... The comment will be refreshed after 00:00.
  • To post as a guest, your comment is unpublished.
    Ali · 2 years ago
    Plz Suggest function about the following criteria
    If A1 have integer/numeric value then pass 1 and if A1 have string/alphabetical value then pass 2