How to show a message with a number in an IF formula in Excel
Formula (Excel and Google Sheets)
=IF(B2<C2,"Order "&C2-B2&" more","Stock OK")Join text and the calculation with &: =IF(B2<C2,"Order "&C2-B2&" more","Stock OK").
- Result on the example
- one result per row in
D2, filled down toD7 - Works in
- Every current version
- Google Sheets
- Same formula
See it work
The formula is already in D2, filled down to D7. Change any input and the result updates, or edit the formula to experiment.
How it works
& joins pieces into one piece of text. Subtraction is worked out before joining, so "Order "&C2-B2&" more" becomes "Order 80 more" without extra parentheses. The spaces inside the quotes keep the words apart.
=IF(B2<C2,"Order "&C2-B2&" more","Stock OK")Result"Order 80 more"
B2120The value in B2.
C2200The value in C2.
B2<C2TRUEThe < operator tests less than.
C2-B280The - operator subtracts.
"Order "&C2-B2"Order 80"The & operator joins as text.
"Order "&C2-B2&" more""Order 80 more"The & operator joins as text.
IF(B2<C2,"Order "&C2-B2&" more","Stock OK")"Order 80 more"IF: Returns one value if a test is true, another if false.- logical_test
B2<C2TRUE - value_if_true
"Order "&C2-B2&" more""Order 80 more" - value_if_false
"Stock OK"not used
- logical_test
In Google Sheets
The same formula works in Google Sheets: =IF(B2<C2,"Order "&C2-B2&" more","Stock OK"). 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 |
|---|---|---|
| =IF(B2<C2,"Order "&TEXT(C2-B2,"#,##0")&" more","Stock OK") | Order 80 more, Stock OK, Order 15 more… | TEXT controls how the number looks inside the message, such as thousands separators or decimals. |
| =IF(B2<C2,CONCAT("Order ",C2-B2," more"),"Stock OK") | Order 80 more, Stock OK, Order 15 more… | CONCAT joins its arguments, the same as &. |
Common mistakes
- A calculated number keeps all its decimals inside text: 12.3456 shows in full. Wrap it in TEXT or ROUND.
- Missing spaces run words together:
"Order"&15gives "Order15". - The result is text, so the column can't be totaled. Keep the number in its own column if you need it.
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.
Show a message with a number in an IF formula
D2, show "Order N more" (N being the shortfall) when stock is below the reorder level, otherwise "Stock OK". Fill down to D7.Questions
How do I put a currency amount in the message?
Format it with TEXT: "Short by "&TEXT(C2-B2,"$#,##0.00").
How do I add a line break inside the message?
Join CHAR(10) and turn on Wrap Text: ="Order"&CHAR(10)&C2-B2&" more".
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.