What you will learn
- Use IF, XLOOKUP, COUNTIF, SUM and SUMIF together
How it works
Flag the items that need reordering. Then look up an item by its code and count the items that need reordering.
Note: this project uses XLOOKUP. It works in Excel 2021 and newer, and in Microsoft 365. In older Excel, use VLOOKUP instead.
Formulas at a glance
=IF(C2<=D2,"Reorder","OK") | The pattern to follow |
=XLOOKUP(H2,A2:A8,B2:B8,"Not found") | The pattern to follow |
Example
Write the formula to show "Reorder" if Pencils In stock is at or below Reorder at. Otherwise "OK".
| A | B | C | D | E | F | G | H | |
|---|---|---|---|---|---|---|---|---|
| 1 | Code | Item | In stock | Reorder at | Status | |||
| 2 | S-01 | Pencils | 40 | 25 | Find code | S-05 | ||
| 3 | S-02 | Erasers | 12 | 15 | Item | |||
| 4 | S-03 | Glue | 8 | 10 | In stock | |||
| 5 | S-04 | Rulers | 30 | 10 | To reorder | |||
| 6 | S-05 | Paper | 5 | 20 | ||||
| 7 | S-06 | Tape | 18 | 15 | Total stock | |||
| 8 | S-07 | Markers | 9 | 12 | Stock to reorder |
Click E2 and type =IF(C2<=D2,"Reorder","OK"), then press Enter.
The answer is OK.
When to use it
- Stock lists for a shop or stock room
- Reorder reports
- Practicing IF, lookups, COUNTIF and SUMIF together
Common mistakes
- Using < when it should be <=At or below the reorder level means <=.
- XLOOKUP showing #NAME?Use VLOOKUP in Excel older than 2021.
- Not locking rangesLock ranges with $ when you copy formulas.
Practice it on a real sheet
Reading is a start. Doing it is how it sticks. This lesson walks you through every click on a live spreadsheet and checks each answer.