Calculation Issues

How to Limit an Excel Running Total to a Maximum and Minimum

Phi Hung VoPhi Hung Vo Nov 10, 2026 869 views

Question details

The user needs to calculate a running inventory balance that adds purchases and subtracts sales, ensuring the final total never exceeds a strict maximum of 10 or falls below a minimum of 0.

How to Limit an Excel Running Total to a Maximum and Minimum
Product
Excel
Device & OS
not provided
Scenario
Tracking inventory or stock where capacity has a hard ceiling (maximum) and the stock level cannot logically be negative.
Observed behavior
The balance needs to be automatically constrained between the values of 0 and 10 using a drag-down formula.
Before you start

Ensure your inventory data is organized into structured columns, typically containing a 'Previous Balance', a 'Purchases' (additions) column, and a 'Sales' (deductions) column so the formula can calculate correctly row by row.

Solution 1Recommended

Use MIN and MAX Functions Combined

This is the most robust and elegant method to set both a hard ceiling (maximum) and floor (minimum) on a calculated value.

By nesting functions, the MIN function first evaluates the sum and 10, returning whichever is smaller to cap the total. Then, the MAX function evaluates that result against 0, returning whichever is larger to prevent negative numbers.

1
Prepare your columns

Set up your worksheet so cell A2 holds the previous balance, B2 is the quantity bought, and C2 is the quantity sold.

2
Enter the formula

Click on the cell where you want the new bounded running total (for example, D2) and type =MAX(MIN(A2+B2-C2, 10), 0).

3
Apply down the column

Press Enter to calculate the first row. Click the fill handle (the small square at the bottom-right corner of the cell) and drag it down to apply this bounding formula to the rest of your inventory rows.

Use MIN and MAX Functions Combined
Flexible Limits: You can change '10' and '0' in the formula to any numerical values that represent your specific maximum and minimum stock requirements.
Manage Inventories Easily

Track Inventory Caps Seamlessly with WPS Spreadsheet

WPS Spreadsheet fully supports the exact MIN, MAX, and IF functions used in Microsoft Excel. You can quickly set up bounded running totals and complex inventory trackers in WPS Office with a smooth, lightweight interface.

  1. 1. Launch WPS Spreadsheet: Open WPS Office and create a new Spreadsheet to start tracking your inventory.
  2. 2. Input Data Columns: Create standard columns for 'Previous Balance' (A), 'Stock In' (B), and 'Stock Out' (C).
  3. 3. Apply Formula: Type =MAX(MIN(A2+B2-C2,10),0) in your Total column, press Enter, and double-click the fill handle to populate the rest of your sheet.
100% compatible with Excel formulas, including MIN, MAX, and nested IFs.Lightweight software that opens instantly, even on older devices.Access to a rich library of built-in templates for inventory and stock tracking.Free to download and use for your daily complex calculation needs.
microsoft office alternative - wps office

Frequently Asked Questions

Can I reference a cell for the maximum limit instead of typing '10'?

Yes. Instead of typing 10 in the formula, you can click on a cell containing your maximum limit (e.g., cell E1). Make sure to use absolute references (with dollar signs) so the limit cell reference doesn't shift when you copy the formula down: =MAX(MIN(A2+B2-C2, $E$1), 0).

Why does my running total formula show a #VALUE! error?

This error usually happens if one of the cells you are referencing (A2, B2, or C2) contains text, spaces, or unrecognized characters instead of a number. Check your columns to ensure all inputs, including seemingly blank cells, are formatted strictly as numbers or are truly empty.

How do I only set a maximum limit without a minimum?

If you only want to cap the total at 10 but do not care if it drops into negative numbers, you can remove the MAX portion of the formula. Simply use: =MIN(A2+B2-C2, 10).