Comparing Two Columns in Excel Using the XLOOKUP Formula

📅 Jan 12, 2026 📝 Sarah Miller

Reconciling discrepant data across massive spreadsheets is a tedious, error-prone struggle for financial professionals. When auditing capital inputs, teams often manually cross-reference standard funding sources-such as private equity, bank loans, and municipal allocations-against actual ledgers. Fortunately, mastering XLOOKUP grants analysts the power to automate this validation instantly. However, this efficiency comes with the stipulation that both datasets must utilize clean, standardized unique identifiers. For example, comparing "Federal Grant ID" in Column A against "Disbursements" in Column B quickly flags missing records. Below, we provide the exact formula syntax to streamline your reconciliation workflow.

Comparing Two Columns in Excel Using the XLOOKUP Formula

Excel Formula to Compare Two Columns Using XLOOKUP

Comparing two columns of data is one of the most common tasks performed in Microsoft Excel. Whether you are reconciling sales reports, checking inventory lists, matching customer databases, or auditing financial records, identifying discrepancies is critical. Traditionally, Excel users relied on combinations of VLOOKUP, INDEX/MATCH, or COUNTIF to achieve this. However, with the introduction of XLOOKUP in Office 365, Excel has provided a far more robust, elegant, and intuitive solution.

In this guide, we will explore how to use the XLOOKUP function to compare two columns in Excel. We will cover basic existence checks, identifying differences, extracting related data based on matches, and using conditional formatting to visually highlight discrepancies.

Why Choose XLOOKUP Over Legacy Functions?

Before diving into formulas, it is helpful to understand why XLOOKUP is superior to older methods for column comparisons:

  • No Left-to-Right Limitation: Unlike VLOOKUP, which requires your lookup column to be the leftmost column of your range, XLOOKUP can search columns to the left or right of your target data.
  • Exact Match by Default: VLOOKUP defaults to an approximate match, which frequently causes errors if you forget to append FALSE to your formula. XLOOKUP defaults to an exact match.
  • Built-in Error Handling: XLOOKUP includes a dedicated [if_not_found] argument, eliminating the need to wrap your formula in IFERROR or IFNA.
  • Flexibility: It can return entire rows or columns, look up data from bottom-to-top, and perform exact or wildcard matches with ease.

Understanding XLOOKUP Syntax

To use XLOOKUP effectively, let us review its syntax:

=XLOOKUP(lookup_value, lookup_array, return_array, [if_not_found], [match_mode], [search_mode])

For comparing columns, we primarily focus on the first four arguments:

  1. lookup_value: The value in Column A that you want to search for in Column B.
  2. lookup_array: The column (Column B) you are searching through.
  3. return_array: The value you want to return. For simple comparison, this is often the search column itself.
  4. [if_not_found]: (Optional but highly useful) The value to return if no match is found (e.g., "Missing" or "No Match").

Method 1: Basic Existence Check (Is It in the Other List?)

Suppose you have a list of new registrants in Column A and a list of invited guests in Column B. You want to see which of your registrants were actually on the guest list. You can write an XLOOKUP formula in Column C next to your first registrant.

Enter the following formula in cell C2 and drag it down:

=XLOOKUP(A2, $B$2:$B$100, $B$2:$B$100, "Not Found")

How This Works:

  • Excel takes the value in A2.
  • It searches for that value inside the absolute range $B$2:$B$100. Absolute references (using dollar signs) are crucial here so that your lookup range remains fixed as you copy the formula down.
  • If it finds the value, it returns the same value from $B$2:$B$100 (confirming a match).
  • If it does not find the value, it immediately outputs "Not Found".

Method 2: Creating a Cleaner "Match" or "No Match" Status

While returning the matched value is useful, you might prefer a cleaner dashboard indicator, such as "Match" or "Missing", rather than seeing the matched name repeated. We can combine XLOOKUP with helper functions or make clever use of the return arrays.

To do this, we can wrap XLOOKUP inside an IF and ISNA statement, or we can use the [if_not_found] argument creatively. A highly streamlined approach is combining XLOOKUP with ISNUMBER or ISNA. However, using IF and ISNA is incredibly intuitive:

=IF(ISNA(XLOOKUP(A2, $B$2:$B$100, $B$2:$B$100, #N/A)), "Missing", "Match")

Alternatively, because XLOOKUP allows you to output custom text directly when a match isn't found, you can evaluate if the returned output is your custom text:

=IF(XLOOKUP(A2, $B$2:$B$100, $B$2:$B$100, "No")="No", "Not Found", "In List")

This approach allows you to quickly filter your columns to see only those items that require attention.

Method 3: Comparing Columns and Pulling Corresponding Data

Sometimes you don't just want to know if a match exists; you want to pull associated information from an adjacent column when a match is verified. This is where XLOOKUP truly shines compared to VLOOKUP or INDEX/MATCH.

Imagine you have a main Master Inventory table in Columns E and F (with Column E being "SKU" and Column F being "Price"). In Column A, you have a list of daily sold SKUs. You need to pull the correct price for each sold SKU from your Master Inventory.

Write this formula in cell B2:

=XLOOKUP(A2, $E$2:$E$500, $F$2:$F$500, "Invalid SKU")

In this scenario:

  • Excel matches the SKU in A2 with the SKU master list in E2:E500.
  • Instead of returning the SKU, it returns the price from the corresponding row in F2:F500.
  • If a sales representative entered a typo, the system displays "Invalid SKU," allowing you to immediately catch clerical errors.

Method 4: Dynamic Row-by-Row Matching

In some circumstances, you are not checking if a value exists *anywhere* in a column, but rather if the values in Column A and Column B match exactly *on the same row* (e.g., Row 2 Column A matches Row 2 Column B). While a simple logical formula like =A2=B2 works, XLOOKUP can be utilized to perform structured checks across entire arrays dynamically.

By leveraging dynamic arrays in Office 365, you can enter a single formula in the top cell and have it spill down automatically:

=MAP(A2:A100, B2:B100, LAMBDA(valA, valB, XLOOKUP(valA, valB, "Identical", "Mismatch")))

This formula checks each row individually and outputs whether they are identical or mismatched, without needing to copy and paste the formula down manually.

Method 5: Applying Conditional Formatting with XLOOKUP

Visual aids can dramatically speed up data auditing. You can use Excel's conditional formatting engine alongside XLOOKUP to highlight cells in Column A that do not exist in Column B.

Follow these steps to set this up:

  1. Select the data range in Column A (e.g., A2:A100).
  2. On the Home tab of the Excel Ribbon, click on Conditional Formatting > New Rule...
  3. Select "Use a formula to determine which cells to format".
  4. Enter the following formula:
    =ISNA(XLOOKUP(A2, $B$2:$B$100, $B$2:$B$100))
  5. Click the Format... button, choose a fill color (such as light red or yellow), and click OK.
  6. Click OK to apply the rule.

Any item in Column A that cannot be found anywhere in Column B will now automatically highlight in red. As you update your lists, the highlighting adjusts dynamically.

Handling Case Sensitivity with XLOOKUP

By default, XLOOKUP is case-insensitive. This means it will treat "APPLE" and "apple" as an identical match. If you are comparing highly sensitive codes, such as password keys, serial numbers, or case-sensitive system IDs, you must force Excel to differentiate character cases.

To perform a case-sensitive column comparison using XLOOKUP, we must introduce the EXACT function. We can write our comparison like this:

=XLOOKUP(TRUE, EXACT(A2, $B$2:$B$100), "Match", "No Match")

Here, the EXACT function compares the value in A2 against every single cell in the array B2:B100, returning an array of TRUE and FALSE values. XLOOKUP then searches for the value TRUE inside that newly generated logical array. This ensures that only an exact case match will result in a "Match".

Summary of Best Practices

When comparing columns using XLOOKUP, keeping these best practices in mind will save you from errors:

  • Lock Your Ranges: Always use absolute references (like $B$2:$B$100) for lookup arrays to prevent ranges from shifting when copying formulas.
  • Ensure Consistent Data Types: Excel will not match text numbers (e.g., "123" stored as text) with numeric values (e.g., 123). Ensure both columns share the same formatting.
  • Clean Your Data: Hidden spaces can cause matches to fail. Consider wrapping your lookup columns or values in the TRIM function to eliminate stray spaces.

By shifting your Excel workflow from VLOOKUP or INDEX/MATCH to XLOOKUP, you gain cleaner syntax, fewer structural errors, and significantly more analytical flexibility when comparing columns.

Disclaimer:
The documents and templates provided on this page are for informational and illustrative purposes only. They do not constitute professional, legal, or financial advice, and should not be relied upon as such. Because individual circumstances and regulatory requirements vary, these materials may not be suitable for your specific needs. We recommend consulting with a qualified professional before adapting or using any of these examples for official or commercial purposes.