How to Calculate Cases per Order Using Excel Formulas
Question details
The user needs an Excel formula to calculate the number of cases required for ordered products by looking up the units per case and dividing the total ordered quantity.

- Product
- Excel
- Device & OS
- not provided
- Scenario
- Managing inventory or processing orders where items are ordered in individual units but need to be packed and calculated in cases.
- Observed behavior
- The user wants a dynamic formula that automatically matches product IDs between sheets, retrieves the units per case, calculates the required cases, and handles unmatched products smoothly.
Ensure your workbook has well-structured data, ideally with a 'Product List' sheet containing unique Product IDs and Units per Case, and an 'Order List' sheet where your ordered quantities are recorded.
Use XLOOKUP and Division (Recommended)
This approach combines the modern XLOOKUP function with division and IFERROR to seamlessly calculate cases per order without displaying errors for missing items.
XLOOKUP is a powerful function available in newer versions of Excel. It can search for a Product ID in your master list and return the corresponding units per case.
Open your Excel workbook and click on the 'Order List' sheet. Select the cell where you want the calculated 'Cases per Order' to appear, for example, cell G2.
Type the formula: =IFERROR(F2/XLOOKUP(E2,'Product List'!$A$2:$A$100,'Product List'!$B$2:$B$100),""). In this formula, F2 represents the ordered quantity, E2 is the order's product ID, and the Product List references point to the ID column and Units per Case column respectively.
Press Enter to execute the formula. Then, click the small square at the bottom-right corner of cell G2 and drag it down to fill the formula through the rest of your order list.

Use VLOOKUP for Older Versions of Excel
If you or your colleagues use older versions of Excel that do not support XLOOKUP, VLOOKUP is the standard alternative to achieve the exact same calculation.
Calculate Cases and Manage Inventory Effectively with WPS Spreadsheet
WPS Spreadsheet fully supports advanced functions like XLOOKUP, VLOOKUP, and IFERROR, allowing you to build complex inventory management systems with ease. It is lightweight, intuitive, and highly compatible with Microsoft Excel.
- 1. Open WPS Spreadsheet: Launch WPS Office and open your inventory or order workbook.
- 2. Set up your sheets: Ensure your 'Product List' and 'Order List' are organized in separate tabs within the same workbook.
- 3. Insert the lookup formula: Use the built-in function wizard to insert XLOOKUP or simply type the =IFERROR(F2/XLOOKUP(...),"") formula directly into your target cell.
- 4. Drag to apply: Click and drag the fill handle to apply the calculation across your entire order sheet effortlessly.

Frequently Asked Questions
What should I do if the XLOOKUP formula returns a #NAME? error?
The #NAME? error usually occurs if you are using an older version of Excel that does not support the XLOOKUP function. In this case, you should switch to using the VLOOKUP alternative provided in the solutions above.
How do I round up the number of cases if there is a remainder?
If you need to ship whole cases and want to round up any partial case requirements, wrap the division calculation in the ROUNDUP function. For example: =IFERROR(ROUNDUP(F2/XLOOKUP(E2,'Product List'!$A$2:$A$100,'Product List'!$B$2:$B$100), 0), "").
Can I use this formula if my Product List and Order List are in completely different workbooks?
Yes. You can reference external workbooks in your XLOOKUP or VLOOKUP formula. Just ensure the master workbook is open when you are creating the formula, and Excel will automatically map the exact file path into the formula structure.




