Excel Formulas to Lookup Price by Product ID: VLOOKUP and XLOOKUP Guide

📅 Feb 25, 2026 📝 Sarah Miller

Manually matching product IDs to unit prices is a tedious process prone to costly pricing discrepancies. Whether securing operational budgets from standard funding sources or reconciling inventory, accurate financial tracking remains critical. Implementing a dynamic Excel lookup formula grants your team instant pricing visibility and eliminates manual data entry risks.

However, this efficiency is contingent upon the stipulation that your source data remains structured and free of duplicate keys. For instance, utilizing the formula =XLOOKUP(A2, Products!A:A, Products!B:B) quickly bridges item IDs with their corresponding prices. Below, we will explore step-by-step how to construct this formula and configure error-handling for seamless financial reporting.

Excel Formulas to Lookup Price by Product ID: VLOOKUP and XLOOKUP Guide

In the world of data management, finance, and retail, Excel is the go-to tool for tracking inventory, managing sales, and analyzing financial records. One of the most common tasks users face daily is retrieving specific information-such as a price-from a master database based on a unique identifier, like a Product ID.

Whether you are managing a small online store with a few dozen items or working with an enterprise resource planning (ERP) export containing tens of thousands of rows, manually searching for prices is inefficient and highly prone to error. Fortunately, Excel offers several powerful formulas to automate this process. In this comprehensive guide, we will explore the three most effective methods to lookup a price based on a Product ID: VLOOKUP, INDEX & MATCH, and the modern powerhouse, XLOOKUP. We will also cover how to handle common errors to ensure your spreadsheets remain clean and professional.


Setting Up the Scenario

Before diving into the formulas, let's establish a standard data scenario. Imagine you have a master inventory table in columns A through D:

Product ID (Col A) Product Name (Col B) Category (Col C) Price (Col D)
PROD-101 Wireless Mouse Electronics $25.00
PROD-102 Mechanical Keyboard Electronics $85.00
PROD-103 USB-C Hub Accessories $45.00
PROD-104 Ergonomic Office Chair Furniture $120.00

Now, let's assume you have a search cell in another part of your sheet-for example, cell F2-where you type a Product ID (e.g., PROD-103). In cell G2, you want to write a formula that automatically looks up the Product ID in your master table and returns the corresponding Price (which should be $45.00).


Method 1: The Classic VLOOKUP

For decades, VLOOKUP (Vertical Lookup) has been the undisputed king of Excel search functions. It searches down the first column of a specified range for a key value and returns a value from another column in the same row.

The VLOOKUP Syntax

=VLOOKUP(lookup_value, table_array, col_index_num, [range_lookup])

  • lookup_value: The value you want to search for (e.g., the Product ID in F2).
  • table_array: The entire table range containing the data (e.g., A2:D5 or A:D for whole columns). Note that the lookup value must be in the first column of this range.
  • col_index_num: The column number in the table from which to retrieve the value. Since Price is in the 4th column of our range (A=1, B=2, C=3, D=4), this number is 4.
  • range_lookup: Set to FALSE (or 0) for an exact match. Crucial step: leaving this empty defaults to TRUE (approximate match), which can lead to disastrously incorrect pricing data!

The VLOOKUP Formula in Action

To find the price of the product listed in cell F2, enter this formula in cell G2:

=VLOOKUP(F2, A2:D5, 4, FALSE)

Limitations of VLOOKUP

While widely compatible across all versions of Excel, VLOOKUP has two major drawbacks:

  • It cannot look left: If your Product ID column is not the very first column in your table array, VLOOKUP will fail.
  • Fragility: If you insert or delete columns in your master table, your column index number (e.g., 4) does not update automatically, causing the formula to return incorrect data or errors.

Method 2: The Robust INDEX & MATCH Combo

To overcome the limitations of VLOOKUP, seasoned Excel professionals turn to the dynamic duo: INDEX and MATCH. By combining these two independent formulas, you create a lookup system that is more flexible, reliable, and slightly faster on very large datasets.

How It Works

  • MATCH finds the relative row position of your Product ID in column A.
  • INDEX retrieves the value from the Price column (column D) at that exact row position.

The INDEX & MATCH Formula

In cell G2, enter the following formula:

=INDEX(D2:D5, MATCH(F2, A2:A5, 0))

Breaking Down the Mechanics

  1. MATCH(F2, A2:A5, 0) searches for the Product ID in range A2:A5. The 0 at the end specifies an exact match. If F2 contains "PROD-103", MATCH returns 3 (because it is the third item in the array).
  2. INDEX(D2:D5, 3) takes the array of prices (D2:D5) and returns the value at the 3rd row position, which is $45.00.

Why INDEX & MATCH is Superior

  • Lookups in any direction: The Price column can be to the left, right, or even on a completely different sheet than the Product ID column.
  • Structural stability: If you insert a new column between Category and Price, the formula adjusts dynamically and continues to work perfectly.

Method 3: The Modern Solution - XLOOKUP

If you are using Excel 365, Excel 2021, or Excel for the Web, Microsoft has provided a modern successor that renders VLOOKUP and INDEX & MATCH largely obsolete: XLOOKUP. It is easier to write, less error-prone, and highly versatile.

The XLOOKUP Syntax

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

  • lookup_value: The value you want to find (cell F2).
  • lookup_array: The column containing the Product IDs (A2:A5).
  • return_array: The column containing the Prices you want to retrieve (D2:D5).

The XLOOKUP Formula

In cell G2, enter this highly simplified formula:

=XLOOKUP(F2, A2:A5, D2:D5)

Key Benefits of XLOOKUP

  • Exact match by default: Unlike VLOOKUP, you do not need to specify FALSE to get an exact match. Excel assumes exact match automatically.
  • No column counting: You simply point to the input range and output range independently.
  • Built-in error handling: XLOOKUP has an optional 4th argument to handle errors gracefully without wrapping the formula in separate functions (more on this below).

Handling Missing Product IDs and Errors

If a user types a Product ID that does not exist in the database (for example, PROD-999), standard Excel formulas will return an ugly #N/A error. This can break downstream calculations and look unprofessional.

Using standard IFERROR or IFNA (for VLOOKUP and INDEX & MATCH)

You can wrap your VLOOKUP or INDEX/MATCH formula in an IFERROR or IFNA function to display a custom message like "Product Not Found" or "Check ID":

=IFNA(VLOOKUP(F2, A2:D5, 4, FALSE), "Price Not Found")
=IFNA(INDEX(D2:D5, MATCH(F2, A2:A5, 0)), "Price Not Found")

Native Error Handling in XLOOKUP

With XLOOKUP, you can handle missing IDs directly inside the main formula using the 4th argument, making your spreadsheet formulas much cleaner:

=XLOOKUP(F2, A2:A5, D2:D5, "Price Not Found")

Summary: Which Formula Should You Choose?

To help you decide which tool is best for your current situation, refer to this quick breakdown comparison:

Formula Compatibility Difficulty Key Advantage
VLOOKUP All Excel versions (Legacy) Easy Universally recognized and supported by older machines/clients.
INDEX & MATCH All Excel versions (Legacy) Intermediate/Hard Flexible, safe from column insertions, optimal for heavy workloads.
XLOOKUP Excel 365, Excel 2021+ (Modern) Very Easy No exact match toggle required, default error-handling, looks left or right.

Recommendation: If you and your team are on modern Excel (Office 365), always use XLOOKUP. It is faster to write and easier to debug. If you are sharing files with external clients who might use older, legacy versions of Excel, use INDEX & MATCH for robust compatibility without sacrificing quality.

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.