Home Tips and Insights 365 Productivity

How to use 'If Error' with a V-Lookup

365 Productivity | By 365 Training Hub | July 10, 2023
How to use 'If Error' with a V-Lookup

When working with Excel, you might encounter situations where your VLOOKUP function returns errors, such as #N/A, if it can’t find the lookup value. To handle these errors gracefully, you can use the IFERROR function to display a custom message or perform an alternative calculation. Here’s a step-by-step guide to creating a nested formula using IFERROR with VLOOKUP.

Step 1: Understand the Basics of VLOOKUP

Before we dive into the nested formula, let’s quickly review the VLOOKUP function. The syntax for VLOOKUP is:

VLOOKUP(lookup_value, table_array, col_index_num, [range_lookup])
  • lookup_value: The value you want to search for.

  • table_array: The range of cells that contains the data.

  • col_index_num: The column number in the table from which to retrieve the value.

  • [range_lookup]: Optional; TRUE for an approximate match or FALSE for an exact match.

Step 2: Understand the Basics of IFERROR

The IFERROR function helps you manage errors in your formulas. The syntax for IFERROR is:

IFERROR(value, value_if_error)
  • value: The formula or expression to check for errors.

  • value_if_error: The value to return if an error is found.

Step 3: Combine IFERROR with VLOOKUP

To create a nested formula that uses IFERROR with VLOOKUP, follow these steps:

  1. Start with the VLOOKUP Formula: Begin by writing your VLOOKUP formula. For example:

    =VLOOKUP(A2, B2:D10, 3, FALSE)
    

  2. Wrap the VLOOKUP Formula with IFERROR: Next, wrap the VLOOKUP formula with IFERROR to handle any errors. For example:

    =IFERROR(VLOOKUP(A2, B2:D10, 3, FALSE), "Not Found")
    

    In this example, if the VLOOKUP function returns an error, the formula will display “Not Found” instead.

Step 4: Enter the Formula in Excel

  1. Click on the cell where you want to enter the formula.

  2. Type the nested formula:

    =IFERROR(VLOOKUP(A2, B2:D10, 3, FALSE), "Not Found")
    

  3. Press Enter to apply the formula.

Step 5: Copy the Formula to Other Cells

If you need to apply the same formula to other cells, you can copy it. Click on the cell with the formula, then drag the fill handle (a small square at the bottom-right corner of the cell) down or across to copy the formula to adjacent cells.

Conclusion

Using IFERROR with VLOOKUP is a powerful way to handle errors in your Excel formulas. By following these steps, you can create a nested formula that ensures your data is displayed cleanly and accurately, even when lookup values are missing. This technique helps maintain the integrity of your spreadsheets and makes them more user-friendly.

Keen to stay up to date on anything 365?

Sign up for tips and updates