Excel Formula to Return the Amount Above 40
Question details
The user needs a formula to calculate only the portion of the sum of two cells that exceeds the value of 40. If the sum is 41, it should return 1; if it is 40 or less, it must return 0.

- Product
- Excel
- Device & OS
- not provided
- Scenario
- Calculating overtime hours, excess quota, or surcharges where only amounts exceeding a specific baseline are counted.
- Observed behavior
- Requires a dynamic logical or mathematical formula to output the difference above a threshold or default to zero when the threshold is not met.
Ensure that the cells you intend to calculate contain valid numeric values, as text strings formatted to look like numbers will cause formula calculation errors.
Using the MAX Function
The MAX function is the most efficient and robust method to ensure your result never drops below zero when subtracting a threshold.
The MAX function analyzes a set of given values and returns the largest one. By comparing your mathematical calculation against 0, you force Excel to return 0 automatically if the calculation results in a negative number.
Click on the blank cell where you want the calculated result to appear.
Type =MAX(0, A1+B1-40) into the formula bar. Replace A1 and B1 with the actual cell references containing your data.
Press Enter on your keyboard. If the sum of A1 and B1 is 41, the cell will display 1. If the sum is 35, it will display 0.

Using the IF Function
An alternative logical approach using the IF function to explicitly test if the cell sum exceeds your threshold.
Use WPS Spreadsheet to Handle Complex Formulas Easily
WPS Spreadsheet provides robust support for all standard Excel functions like MAX and IF. You can calculate excess amounts, manage budgets, and track data with high efficiency and absolute format compatibility without paying for expensive subscriptions.
- 1. Open WPS Spreadsheet: Launch WPS Office on your computer and open a new or existing spreadsheet.
- 2. Input your data: Type your base numerical values into the desired cells, such as A1 and B1.
- 3. Apply the threshold formula: Type =MAX(0, A1+B1-40) in your output cell and press Enter to instantly see the calculated excess.

Frequently Asked Questions
Can I use this formula across multiple columns or rows at once?
Yes. After entering the formula in the first cell, you can use the fill handle (the small square at the bottom right corner of the selected cell). Click and drag it down or across to apply the formula to other cells. The relative cell references (like A1 and B1) will adjust automatically for each new row.
What if I need to calculate the amount above a threshold for a single cell instead of two?
You can easily modify the formula to reference only one cell. Simply remove the addition from the formula. For example, use =MAX(0, A1-40) to calculate only the amount in cell A1 that exceeds 40.
Why is my formula returning a #VALUE! error instead of a number?
This error usually happens if the referenced cells contain text, spaces, or unrecognized characters instead of pure numbers. Ensure that the cells you are summing are formatted as Numbers or General, and do not contain hidden leading or trailing spaces.




