How to Calculate Running Quantity on Hand in Excel
Question details
The user needs a reliable formula to maintain a running balance for inventory quantity on hand.

- Product
- Excel / WPS Spreadsheet
- Device & OS
- not provided
- Scenario
- Managing inventory records where new receipts must be added and issues or sales must be subtracted from an opening balance.
- Observed behavior
- A running quantity-on-hand calculation needs to update correctly row by row without repeatedly double-counting previous historical transactions.
Ensure your inventory data is organized in a tabular format with dedicated columns for your Opening Balance, Quantity Added (Receipts), and Quantity Removed (Issues).
Use a Row-by-Row Running Balance Formula
Calculate the inventory balance by referencing the previous row's balance, adding new receipts, and subtracting issues to maintain a precise running total.
The safest design for a running balance stores the opening quantity separately and calculates each row strictly from the prior balance. This prevents the spreadsheet from repeatedly recalculating all historical transactions, which improves performance and avoids double-counting.
Place your initial opening quantity in the first balance cell of your inventory tracking table (e.g., cell D2).
In the next row's balance cell (e.g., cell D3), enter the formula =D2+B3-C3. In this example, D2 is the previous balance, B3 is the quantity added, and C3 is the quantity removed.
Press Enter on your keyboard to calculate the new quantity on hand for that specific row.
Click the fill handle located at the bottom-right corner of cell D3, and drag it down your column to apply the running formula to the remaining inventory transactions.

Track Inventory and Calculate Balances in WPS Spreadsheet
WPS Spreadsheet is a powerful, free tool that supports all standard Excel formulas, including running balances for inventory management. It offers a familiar interface and seamless compatibility with your existing workbooks.
- 1. Open your inventory sheet: Launch WPS Spreadsheet and open your existing inventory tracking workbook.
- 2. Select the target cell: Click on the cell where you want the running balance to first calculate.
- 3. Apply the running formula: Type your running balance formula (e.g., =D2+B3-C3) and press the Enter key.
- 4. Drag to fill: Use the fill handle at the bottom right of the cell to drag the formula down, instantly updating the quantity on hand for all subsequent rows.

Frequently Asked Questions
Why is my running balance formula returning a #VALUE! error?
Errors like #VALUE! occur if the referenced cells contain text instead of numbers. Ensure your 'Quantity Added' and 'Quantity Removed' columns only contain numeric values or are left completely blank.
How can I prevent negative inventory balances in my spreadsheet?
You can use the MAX function to prevent the running balance from dropping below zero. For example, modify your formula to =MAX(0, D2+B3-C3).
How do I hide the running balance on rows that have no transactions?
To prevent the formula from repeating the previous balance down empty rows, wrap your formula in an IF statement. Use =IF(AND(B3="", C3=""), "", D2+B3-C3) to keep the cell blank until data is entered.
Can I calculate a running total if my data is formatted as an Excel Table?
Yes, but standard cell references (like =D2+B3-C3) are usually more stable for running totals in Tables. If you prefer structured references, you can use a formula like =SUM(INDEX([Quantity Added],1):[@Quantity Added]) - SUM(INDEX([Quantity Removed],1):[@Quantity Removed]) along with the opening balance.




