Keep a Running Inventory Total in Excel After Clearing a Worksheet
Question details
Keep a running inventory balance after completed project data is cleared from a linked worksheet.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- A project worksheet records inventory usage and is cleared for reuse after each project.
- Observed behavior
- Clearing the project worksheet removes the source data used to calculate inventory deductions.
Identify the item names and quantities on the project worksheet, along with the opening balance for each item. Decide how to identify completed projects so you do not record the same deduction twice.
Record completed projects in a permanent inventory ledger
Use a separate ledger to preserve each deduction before clearing the project worksheet.
A formula cannot retain deductions from cells whose contents have been cleared. A permanent ledger gives the balance formula a history to reference.
Add a worksheet named Ledger with columns for item, quantity change, date, and project ID. Enter deductions as negative numbers and additions as positive numbers.
On your inventory sheet, enter each item name in column A and its opening balance in column B. Use the same item names in the Ledger sheet.
In cell C2 of the inventory sheet, enter =B2+SUMIFS(Ledger!$B:$B,Ledger!$A:$A,A2), assuming the ledger has item names in column A and signed quantity changes in column B. Fill the formula down for the other items.
Before clearing the project worksheet, add a ledger row for each item used, including its negative quantity and project ID. If copying calculated values, use Home > Paste > Paste Special > Values so the ledger does not depend on cells you will clear.
Verify that the project ID is recorded only once and that the inventory balances reflect its deductions. Then select the project entry cells and use Home > Clear > Clear Contents.

Maintain an Inventory Ledger in WPS Spreadsheet
Use a permanent ledger and a SUMIFS formula in WPS Spreadsheet to preserve project deductions when you clear a reusable worksheet.
- 1. Open the workbook: Open WPS Spreadsheet and use Open to select your inventory workbook.
- 2. Add a ledger: Add a sheet named Ledger and create columns for item, quantity change, date, and project ID. Record deductions as negative quantities.
- 3. Enter the balance formula: On the inventory sheet, put item names in column A and opening balances in column B. In C2, enter =B2+SUMIFS(Ledger!$B:$B,Ledger!$A:$A,A2), then fill it down.
- 4. Record and clear each project: Before clearing project entries, add their item deductions and project ID to Ledger. Check the balances and project ID, then select the project entry cells and clear their contents.
- 5. Save the workbook: Use File > Save As and choose an Excel workbook format such as XLSX.

Frequently Asked Questions
Why does my inventory total change when I clear the project sheet?
The inventory formula depends on cells in the project sheet. When you clear those cells, the formula no longer has their values to include. Record completed deductions in a permanent ledger first.
How should I enter inventory deductions in the ledger?
Enter a separate row for each item and use a negative quantity change for stock used. Use a positive quantity for stock added, and include a project ID to help prevent duplicate entries.
Can I use a PivotTable instead of SUMIFS?
Yes. Select the permanent ledger and choose Insert > PivotTable, then group by item and sum the quantity changes. Refresh the PivotTable after adding transactions, and combine those changes with each item's opening balance.
What if the project quantities are calculated by formulas?
Copy the completed quantities and use Paste Special > Values in the ledger before clearing the project cells. Store deductions as negative numbers so they reduce the opening balance.




