VLOOKUP in Excel with example

The VLOOKUP function is used to search for a value in the first column of a range and return a value in the same row from another column in the range.


Syntax:

=VLOOKUP(lookup_value, table_array, col_index_num, [range_lookup])
  • lookup_value: The value to search for.
  • table_array: The range of cells that contains the data.
  • col_index_num: The column number (in the range) from which to return the value.
  • range_lookup: Optional; TRUE for approximate match or FALSE for exact match.

Example: Employee Data Lookup

Sample Data:

IDNameDepartmentSalary
101John SmithIT60000
102Mary JohnsonHR55000
103Alex BrownFinance75000
104Chris LeeMarketing52000
105Sarah WilsonIT58000

Task:

Find the Department and Salary of an employee with ID 103.


Step 1: Use VLOOKUP for Department

  1. Formula: =VLOOKUP(103, A2:D6, 3, FALSE)
  2. Explanation:
    • 103: The value to look for in the first column.
    • A2:D6: The table array containing the data.
    • 3: The column number for the Department.
    • FALSE: An exact match is required.
  3. Result: Finance

Step 2: Use VLOOKUP for Salary

  1. Formula: =VLOOKUP(103, A2:D6, 4, FALSE)
  2. Explanation:
    • 103: The value to look for in the first column.
    • A2:D6: The table array containing the data.
    • 4: The column number for the Salary.
    • FALSE: An exact match is required.
  3. Result: 75000

Key Notes:

  1. The lookup_value (e.g., ID) must be in the first column of the table.
  2. The col_index_num specifies the column to return a value from (relative to the table range).
  3. Use FALSE for an exact match (recommended for most use cases).

Use Case Example:

IDLookup Department FormulaLookup Salary Formula
103=VLOOKUP(103, A2:D6, 3, FALSE)=VLOOKUP(103, A2:D6, 4, FALSE)

Additional Examples with VLOOKUP

Example 1: Looking Up Employee Name by ID

Suppose you have a dropdown in cell F1 where users can enter an ID, and you want to display the corresponding Name in G1.

Formula in G1: =VLOOKUP(F1, A2:D6, 2, FALSE)

  • If F1 contains 105, result: Sarah Wilson
  • This dynamic setup allows quick lookups without rewriting the formula each time.

Example 2: Handling Errors with IFERROR

VLOOKUP returns #N/A if the lookup_value isn’t found. To make your sheet cleaner:

Formula: =IFERROR(VLOOKUP(F1, A2:D6, 3, FALSE), "Employee Not Found")

  • If ID 999 is entered (not in the table), it displays “Employee Not Found” instead of an error.

Example 3: Approximate Match with TRUE

Assume the first column (ID) is sorted ascending. You can use approximate match for range-based lookups.

Imagine a commission table:

Sales AmountCommission Rate
00%
500005%
10000010%

Formula to find rate for $72,000 sales: =VLOOKUP(72000, H2:I4, 2, TRUE)

Result: 5% (since 72000 falls between 50000 and 100000).

Note: Always sort the first column ascending for TRUE to work correctly.

Example 4: VLOOKUP with Wildcards for Partial Matches

Use wildcards when range_lookup is FALSE for text searches.

Suppose you want to find employees with “Smith” in their name (but name is not in first column—wait, VLOOKUP can’t search non-first columns directly).

Actually, for partial text matches in the lookup column:

Formula: =VLOOKUP("*Smith*", A2:D6, 2, FALSE)

This would return the first matching name containing “Smith” (John Smith).

Example 5: Combining VLOOKUP with Other Functions

Calculate bonus as 10% of salary for a given ID.

Formula: =VLOOKUP(F1, A2:D6, 4, FALSE) * 0.1

If F1 is 103, result: 7500 (10% of 75000).

Or display full details: =VLOOKUP(F1, A2:D6, 2, FALSE) & " works in " & VLOOKUP(F1, A2:D6, 3, FALSE) & " earning $" & VLOOKUP(F1, A2:D6, 4, FALSE)

Result for 103: Alex Brown works in Finance earning $75000

Common VLOOKUP Pitfalls and How to Avoid Them

  1. #N/A Error: Lookup value not found. Use IFERROR or check data/types (e.g., ID as text vs number).
  2. #REF! Error: col_index_num larger than columns in table_array.
  3. Wrong Results: Forgetting FALSE leads to unexpected approximate matches.
  4. Data Type Mismatch: Ensure lookup_value and first column are same type (use TEXT or VALUE functions if needed).
  5. Table Array Not Locked: When copying formulas, use absolute references: $A$2:$D$6.

When to Use Alternatives

While VLOOKUP is great for vertical lookups from left to right, consider:

  • XLOOKUP (Excel 365/2021+): More flexible, can search right-to-left, return arrays, better error handling.
  • INDEX + MATCH: Powerful combo for lookups in any direction.
  • HLOOKUP: For horizontal data.

Mastering VLOOKUP builds a strong foundation for efficient data management in Excel. Practice with larger datasets, combine with tables (Ctrl+T), and explore dynamic named ranges for even better results.

Product Inventory Lookup Example

Let’s explore VLOOKUP with a different dataset: a product inventory table for an online store.

Assume the data is in cells A1:E11 (with headers in row 1):

Product IDProduct NameCategoryPriceStock
P101Wireless MouseElectronics25.99150
P102Mechanical KeyboardElectronics89.9980
P103USB-C HubAccessories45.50200
P104Laptop StandAccessories34.99120
P105Noise-Cancelling HeadphonesElectronics199.9950
P106External SSD 1TBStorage119.9995
P107Webcam HDElectronics69.99110
P108Ergonomic ChairFurniture299.9930
P109Monitor 27″Electronics249.9965
P110Cable OrganizerAccessories12.99300

The table_array for all examples below is A2:E11.

Example 1: Lookup Product Name and Price for a Given ID

Enter Product ID in cell G1 (e.g., P106).

  • Name formula in H1: =VLOOKUP(G1, $A$2:$E$11, 2, FALSE)
  • Result for P106: External SSD 1TB
  • Price formula in I1: =VLOOKUP(G1, $A$2:$E$11, 4, FALSE)
  • Result for P106: 119.99

Example 2: Find Category and Stock Level

For Product ID P108:

  • Category: =VLOOKUP("P108", $A$2:$E$11, 3, FALSE)
  • Result: Furniture
  • Stock: =VLOOKUP("P108", $A$2:$E$11, 5, FALSE)
  • Result: 30

This helps quickly check availability for high-value items like chairs.

Example 3: Calculate Total Value of Remaining Stock

Combine VLOOKUP with multiplication for inventory valuation.

Formula: =VLOOKUP(G1, $A$2:$E$11, 4, FALSE) * VLOOKUP(G1, $A$2:$E$11, 5, FALSE)

  • If G1 is P105 (Noise-Cancelling Headphones):
  • Price: 199.99 × Stock: 50 = 9999.5
  • Result: 9999.5 (total value in dollars)

Add currency formatting for professional reports.

Example 4: Low Stock Alert Using IF and VLOOKUP

Flag products with low stock (e.g., below 60 units).

Formula: =IF(VLOOKUP(G1, $A$2:$E$11, 5, FALSE) < 60, "Low Stock - Reorder!", "In Stock")

  • For P105 (stock 50): Low Stock – Reorder!
  • For P103 (stock 200): In Stock

Great for dashboard alerts.

Example 5: Display Full Product Details in One Cell

Concatenate multiple VLOOKUPs for a summary sentence.

Formula: =VLOOKUP(G1, $A$2:$E$11, 2, FALSE) & " is in the " & VLOOKUP(G1, $A$2:$E$11, 3, FALSE) & " category, priced at $" & VLOOKUP(G1, $A$2:$E$11, 4, FALSE) & " with " & VLOOKUP(G1, $A$2:$E$11, 5, FALSE) & " units in stock."

  • For P109: Monitor 27″ is in the Electronics category, priced at $249.99 with 65 units in stock.

This creates readable product descriptions for reports or customer inquiries.

These examples show how versatile VLOOKUP becomes with real-world inventory data—perfect for pricing checks, stock management, and quick reporting.