Excel Formula to Deduct Previous Leave Balance Before Current Leave
Question details
The user needs a formula to deduct employee leave usage from the previous year's remaining balance first, and then subtract any excess from the current year's entitlement.

- Product
- Excel
- Device & OS
- not provided
- Scenario
- Building an annual employee leave-tracking spreadsheet that prioritizes using older, carried-over leave balances before touching the newly accrued leave.
- Observed behavior
- The user needs to calculate both the remaining previous balance and the remaining current balance accurately without overwriting the original source values.
Ensure that your spreadsheet has dedicated columns for the starting balances (Previous and Current) and the Leave Used. Do not attempt to overwrite a cell with its own calculation, as this will trigger a circular reference error.
Use the MAX Function to Calculate Remaining Balances
By using the MAX function, you can safely deduct used leave while preventing any balance from dropping below zero. This automatically cascades excess usage into the current year's balance.
This method avoids complex nested IF statements. The MAX function evaluates a calculation and returns zero if the result is negative, ensuring leave balances are realistically bounded.
Assign Column A (e.g., A2) for the Previous Balance, Column B (e.g., B2) for the Current Entitlement, and Column C (e.g., C2) for the Leave Used.
In an empty cell (e.g., D2), input the formula =MAX(0, A2-C2) and press Enter. This subtracts the used leave from the previous balance but stops at zero if the used leave exceeds it.
In the next empty cell (e.g., E2), input the formula =MAX(0, B2-MAX(0, C2-A2)). This calculates how much used leave was left over after draining the previous balance, and deducts that remainder from the current year's entitlement.

Alternative Method Using Basic IF Functions
If you prefer logical statements over the MAX function, you can achieve the exact same cascading deduction using standard IF functions.
Build Professional Leave Trackers with WPS Spreadsheet
WPS Spreadsheet provides robust support for logical and mathematical functions like MAX, MIN, and IF. You can easily build automated, error-free leave trackers using the exact same formulas as Excel.
- 1. Launch WPS Spreadsheet: Open WPS Office, select Spreadsheet, and create a new blank workbook or open your existing leave tracker file.
- 2. Input Source Data: Create columns for 'Previous Balance', 'Current Allowance', and 'Days Taken'.
- 3. Apply Automation Formulas: Enter the =MAX() formulas into the remaining balance columns to instantly automate the cascading deductions.

Frequently Asked Questions
Why do I get a circular reference error when calculating leave?
A circular reference error occurs when you try to output a formula's result into a cell that is also used in the formula's calculation (for example, trying to update cell A2 by subtracting C2 directly inside A2). Always output your remaining balances into entirely new columns.
How do I calculate the total remaining leave after both deductions?
Once you have calculated the remaining previous balance (e.g., in D2) and the remaining current balance (e.g., in E2), you can find the total remaining leave by simply adding them together in a new cell using the formula =D2+E2.
Can I use these formulas if I track leave in hours instead of days?
Yes, the formulas =MAX(0, A2-C2) and =MAX(0, B2-MAX(0, C2-A2)) are purely mathematical and will work exactly the same whether your data represents days, hours, or monetary values.




