How to Calculate Positive Differences in Excel Using the MAX Function
Question details
The user needs a formula to calculate the difference between two cells and display the result only if it is positive. If the difference is negative or zero, the cell should display zero.
- Product
- Excel
- Device & OS
- not provided
- Scenario
- Calculating conditional differences where negative results are not desired, such as for tracking surpluses or avoiding negative balances.
- Observed behavior
- The target cells must conditionally display either the positive difference of the subtraction or a zero.
Ensure you have identified the correct cell references for your calculation to prevent accidental logical errors in your spreadsheet.
Use the MAX Function to Return Only Positive Differences
The MAX function is the most efficient and concise way to ensure a formula only returns a positive number or zero.
The MAX function evaluates a set of values and returns the largest one. By comparing your subtraction calculation against 0, the function will return 0 if your calculation results in a negative number.
Click on the cell where you want the first result to appear (for example, cell C11).
Type =MAX(0, A23-A9) and press the Enter key. This tells Excel to subtract A9 from A23, and return either that result or 0, depending on which value is larger.
To calculate the reverse difference in another cell (for example, C25), select the cell and enter =MAX(0, A9-A23) then press Enter.
Calculate Conditional Formulas Easily in WPS Spreadsheet
WPS Spreadsheet fully supports the MAX function and offers a highly compatible, free alternative to Microsoft Excel for handling all your data calculation needs seamlessly.
- 1. Open your workbook: Launch WPS Spreadsheet and open your existing .xlsx file.
- 2. Select the cell: Click the cell where you want to calculate the positive difference.
- 3. Input the formula: Type =MAX(0, [Cell1]-[Cell2]) and hit Enter to instantly get your result.

Frequently Asked Questions
Can I use the IF function instead of MAX for this?
Yes, you can use an IF formula like =IF(A23-A9>0, A23-A9, 0). However, using the MAX function is shorter, more elegant, and less prone to typing errors when dealing with complex calculations.
What happens if one of the cells contains text instead of numbers?
If the referenced cells contain text instead of numbers, the formula will return a #VALUE! error. Ensure all referenced cells are correctly formatted as numbers or currencies.
How do I apply this positive difference formula to an entire column?
After entering the formula in the first cell, click the small square (fill handle) at the bottom-right corner of the cell and drag it down the column to automatically apply the formula to the remaining rows.




