KutoolsforOffice — One Suite. Five Tools. Get More Done.

How to compare alphanumeric values in two columns in Excel?

AuthorXiaoyangLast modified

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 methods for comparing alphanumeric values

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 methods for comparing alphanumeric values

The three methods below compare alphanumeric values in different ways. The formula is useful when you want to mark matches, VBA can create separate lists of values that appear in only one column, while Kutools for Excel is designed for quickly selecting and highlighting same or different values directly in the worksheet.

MethodBest forWhat you getKey consideration
FormulaChecking whether values in one column also appear in anotherDisplays a "Match" label beside matching valuesRequires entering and filling a MATCH-based formula down the result column
VBA codeCreating separate lists of values unique to each columnLists "A not in B" and "B not in A" in separate columnsRequires VBA code and may need code changes for a different worksheet layout
Kutools for ExcelQuickly finding and visually identifying same or different valuesSelects matching or different cells and can apply background or font colorNo formulas or VBA — choose Same Values or Different Values and apply the desired highlighting
Recommendation: Use the formula when you need a dynamic indicator showing which values have matches, or VBA when you specifically need separate lists of values found only in each column. For quickly comparing two columns and visually identifying the same or different values, Kutools for Excel offers the most convenient approach. It lets you switch between same and different values and select or highlight the results directly without creating formulas or writing VBA code.

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” displayed next to the corresponding cell if the cell value exists in both columns, see screenshot:

A screenshot showing how to compare alphanumeric values in two Excel columns using a formula


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()
'Updateby Extendoffice
    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:

A screenshot showing the result of comparing two columns of alphanumeric values using VBA


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

If you want to quickly compare two columns without setting up formulas or VBA, Kutools for Excel's Select Same & Different Cells feature provides a convenient solution. It can select same or different values and optionally highlight the selected cells with a background or font color.

Kutools for Excel offers over 300 advanced features to streamline complex tasks, boosting creativity and efficiency. Integrated with AI capabilities, Kutools automates tasks with precision, making data management effortless. Detailed information of Kutools for Excel...         Free trial...

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:

A screenshot of the Select Same & Different Cells option on the Kutools tab on the ribbon

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

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

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

(3.) Select Same Values if you want to find matching cell values under the Find section;

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

A screenshot of the Select Same & Different Cells dialog box

3. After finishing the settings, click OK. A prompt box will display how many cells have been selected, and the matching values will be selected and highlighted according to your settings, see screenshot:

A screenshot showing highlighted matching values in two columns using Kutools

Notes:

1. If you select Different Values in the Select Same & Different Cells dialog box, the different values in the comparison will be selected and highlighted as shown below:

A screenshot showing highlighted different values between two columns using Kutools

2. To select or highlight results in the other column, swap the ranges in the Find values in and According to boxes as needed.

Kutools for Excel - Supercharge Excel with over 300 essential tools, making your work faster and easier, and take advantage of AI features for smarter data processing and productivity. Get It Now


Demo: Compare alphanumeric values in two columns using Kutools for Excel

 
Kutools for Excel: Over 300 handy tools at your fingertips! Enjoy AI-powered features for smarter and faster work! Download Now!

Best Office Productivity Tools

🤖Kutools AI Aide: Revolutionize data analysis based on: Intelligent Execution   |  Generate Code  |  Create Custom Formulas  |  Analyze Data and Generate Charts  |  Invoke Kutools Functions…
Popular Features: Find, Highlight or Identify Duplicates   |  Delete Blank Rows   |  Combine Columns or Cells without Losing Data   |  Round without Formula ...
Super Lookup: Multiple Criteria VLookup  |   Multiple Value VLookup  |   VLookup Across Multiple Sheets   |   Fuzzy Lookup ....
Advanced Drop-down List: Quickly Create Drop Down List   |  Dependent Drop Down List   |  Multi-select Drop Down List ....
Column Manager: Add a Specific Number of Columns  |  Move Columns  |  Toggle Visibility Status of Hidden Columns  |  Compare Ranges & Columns ...
Featured Features: Grid Focus   |  Design View   |  Big Formula Bar   |  Workbook & Sheet Manager   |  Resource Library (Auto Text)   |  Date Picker   |  Combine Worksheets   |  Encrypt/Decrypt Cells   |  Send Emails by List   |  Super Filter   |   Special Filter (filter bold/italic/strikethrough...) ...
Top 15 Toolsets:  12 Text Tools (Add Text, Remove Characters, ...)   |   50+ Chart Types (Gantt Chart, ...)   |   40+ Practical Formulas (Calculate age based on birthday, ...)   |   19 Insertion Tools (Insert QR Code, Insert Picture from Path, ...)   |   12 Conversion Tools (Numbers to Words, Currency Conversion, ...)   |   7 Merge & Split Tools (Advanced Combine Rows, Split Cells, ...)   |   ... and more
Use Kutools in your preferred language – supports English, Spanish, German, French, Chinese, and 40+ others!

Supercharge Your Excel Skills with Kutools for Excel, and Experience Efficiency Like Never Before. Kutools for Excel Offers Over 300 Advanced Features to Boost Productivity and Save Time.  Click Here to Get The Feature You Need The Most...


Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier

  • Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
  • Open and create multiple documents in new tabs of the same window, rather than in new windows.
  • Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!

All Kutools add-ins. One installer

Kutools for Office suite bundles add-ins for Excel, Word, Outlook & PowerPoint plus Office Tab Pro, which is ideal for teams working across Office apps.

ExcelWordOutlookTabsPowerPoint
  • All-in-one suite — Excel, Word, Outlook & PowerPoint add-ins + Office Tab Pro
  • One installer, one license — set up in minutes (MSI-ready)
  • Works better together — streamlined productivity across Office apps
  • 30-day full-featured trial — no registration, no credit card
  • Best value — save vs buying individual add-in