Module 7 · Lookup · Parts we do not stock

Kofi Mensah works at the counter of Kestrel Auto Parts

Customers order parts that Kestrel does not stock. The lookup shows #N/A, and the total breaks. Kofi wants a clear answer for each order and a total that works.

Loading the spreadsheet…

Module 7 · Lookup

Parts we do not stock

Kofi Mensah, works at the counter of Kestrel Auto Parts
Kofi Mensah works at the counter of Kestrel Auto Parts

Customers order parts that Kestrel does not stock. The lookup shows #N/A, and the total breaks. Kofi wants a clear answer for each order and a total that works.

Steps

  1. Show a text if XLOOKUP finds nothing

    XLOOKUP has a fourth value: if_not_found. XLOOKUP gives it back when it does not find the value.

    How to do it

    1. Select the cell for the result.
    2. Type XLOOKUP with the value to find, the lookup column and the return column. Type a comma.
    3. Type the text for if_not_found and a closing bracket.
    4. Press Enter.

    =XLOOKUP(C5,H:H,I:I,"Not stocked")

    Task: Find the part names for the other orders. Fill in D6:D12.

  2. Catch #N/A from VLOOKUP with IFERROR

    VLOOKUP has no if_not_found value. Put it inside IFERROR to give back a different value.

    How to do it

    1. Click cell E5.
    2. Type IFERROR and the VLOOKUP inside it. Type a comma.
    3. Type the value for an error and a closing bracket.
    4. Press Enter.
    5. XLOOKUP can do the same with a number: =XLOOKUP(C5,H:H,J:J,0).

    =IFERROR(VLOOKUP(C5,H:J,3,FALSE),0)

    Task: Find the prices for the other orders. Fill in E6:E12.