Spreadsheet Practice

How to use IF with VLOOKUP in Excel

Formula (Excel and Google Sheets)

=IF(VLOOKUP(B2,$F$2:$G$5,2,FALSE)>=C2,"Ship","Backorder")

Use the VLOOKUP result inside the IF test: =IF(VLOOKUP(B2,$F$2:$G$5,2,FALSE)>=C2,"Ship","Backorder").

Result on the example
one result per row in D2, filled down to D6
Works in
Every current version
Google Sheets
Same formula

See it work

The formula is already in D2, filled down to D6. Change any input and the result updates, or edit the formula to experiment.

How it works

VLOOKUP returns the stock for the SKU, and that number is compared with the quantity like any other value. IF turns the comparison into a decision. SO-5 asks for exactly the 18 in stock, so it ships.

=IF(VLOOKUP(B2,$F$2:$G$5,2,FALSE)>=C2,"Ship","Backorder")

Result"Ship"

  1. B2"P-101"

    The value in B2.

  2. $F$2:$G$54 rows × 2 cols: "P-101", 140, "P-102", 32, …

    A range: 4 rows × 2 columns.

  3. VLOOKUP(B2,$F$2:$G$5,2,FALSE)140

    VLOOKUP: Finds a value in the first column and returns a value from the same row. Use FALSE for exact.

    • lookup_valueB2"P-101"
    • table_array$F$2:$G$54 rows × 2 cols: "P-101", 140, "P-102", 32, …
    • col_index_num2
    • range_lookupFALSE
  4. C25

    The value in C2.

  5. VLOOKUP(B2,$F$2:$G$5,2,FALSE)>=C2TRUE

    The >= operator tests at least.

  6. IF(VLOOKUP(B2,$F$2:$G$5,2,FALSE)>=C2,"Ship","Backorder")"Ship"

    IF: Returns one value if a test is true, another if false.

    • logical_testVLOOKUP(B2,$F$2:$G$5,2,FALSE)>=C2TRUE
    • value_if_true"Ship"
    • value_if_false"Backorder"not used

In Google Sheets

The same formula works in Google Sheets: =IF(VLOOKUP(B2,$F$2:$G$5,2,FALSE)>=C2,"Ship","Backorder"). We ran it in Google Sheets mode on the same data and it returns the same results.

Other ways to do it

Each one was run on the same example sheet.

FormulaResultWhen to use it
=IF(XLOOKUP(B2,$F$2:$F$5,$G$2:$G$5)>=C2,"Ship","Backorder")Ship, Backorder, Ship…The XLOOKUP version, with separate lookup and return columns.
=IFNA(IF(VLOOKUP(B2,$F$2:$G$5,2,FALSE)>=C2,"Ship","Backorder"),"Unknown SKU")Ship, Backorder, Ship…Shows a message for SKUs missing from the stock table instead of #N/A.

Common mistakes

  • Without FALSE, VLOOKUP does an approximate match and can compare against another product's stock.
  • A SKU missing from the table makes the whole formula return #N/A. Wrap it in IFNA.
  • Lock the stock table with $ before filling down.
  • Stock numbers stored as text compare wrongly: Excel ranks any text above any number, so "4" >= 25 is TRUE and the order shows "Ship". Convert the stock column to real numbers first.

Try it yourself

Same data, empty answer cell. Your formula is graded instantly, then re-checked on changed data, so a typed-in number won't pass.

Use IF with VLOOKUP

In D2, look up the stock for the SKU in the table F2:G5 and show "Ship" when it covers the quantity ordered, otherwise "Backorder". Fill down to D6.

Questions

Can IF choose which table VLOOKUP searches?

Yes: =VLOOKUP(B2,IF(A2="East",$F$2:$G$5,$I$2:$J$5),2,FALSE).

How do I return a blank when the SKU isn't found?

=IFNA(VLOOKUP(B2,$F$2:$G$5,2,FALSE),"").

Checked by running on 2026-10-30: every formula and result on this page was calculated by the Spreadsheet Practice formula engine, in both Excel and Google Sheets modes.