How to calculate shipping cost with an IF formula in Excel
Formula (Excel and Google Sheets)
=IF(B2>=$F$1,0,$F$2)Return 0 when the order reaches the free-shipping threshold and the fee otherwise: =IF(B2>=$F$1,0,$F$2).
- Result on the example
- one result per row in
C2, filled down toC6 - Works in
- Every current version
- Google Sheets
- Same formula
See it work
The formula is already in C2, filled down to C6. Change any input and the result updates, or edit the formula to experiment.
How it works
When the subtotal reaches the threshold in F1, IF returns 0; otherwise it returns the fee in F2. Order 1003 is exactly 75 and ships free because the test uses >=.
=IF(B2>=$F$1,0,$F$2)Result0
B2$82.40The value in B2.
$F$1$75The value in F1.
B2>=$F$1TRUEThe >= operator tests at least.
$F$2$6.95not usedThe value in F2.
IF(B2>=$F$1,0,$F$2)0IF: Returns one value if a test is true, another if false.- logical_test
B2>=$F$1TRUE - value_if_true
0 - value_if_false
$F$2$6.95not used
- logical_test
In Google Sheets
The same formula works in Google Sheets: =IF(B2>=$F$1,0,$F$2). 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.
| Formula | Result | When to use it |
|---|---|---|
| =(B2<$F$1)*$F$2 | $0.00, $6.95, $0.00… | The test is 1 or 0, so it can multiply the fee directly. |
| =IFS(B2>=$F$1,0,B2>=30,4.95,TRUE,$F$2) | $0.00, $4.95, $0.00…Different result | Adds a middle tier with reduced shipping from 30. Order 1002 pays 4.95. |
Common mistakes
- > versus >= decides the order exactly at the threshold. Match your policy's wording: "over" or "from".
- Decide whether the threshold applies before or after discounts and tax, and calculate on that amount.
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.
Calculate shipping cost with an IF formula
C2, charge the flat fee in F2 unless the subtotal is at least the amount in F1, in which case shipping is 0. Fill down to C6.Questions
How do I show the total with shipping?
=B2+IF(B2>=$F$1,0,$F$2).
How do I tell customers how much more to spend?
=IF(B2<$F$1,"Add "&TEXT($F$1-B2,"$0.00")&" for free shipping","").
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.