logo
search
Function Problems

How to Calculate Positive Differences in Excel Using the MAX Function

Maira MehtabMaira Mehtab Sep 22, 2026 868 views

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.
Before you start

Ensure you have identified the correct cell references for your calculation to prevent accidental logical errors in your spreadsheet.

Solution 1Recommended

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.

1
Select the first target cell

Click on the cell where you want the first result to appear (for example, cell C11).

2
Enter the primary MAX formula

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.

3
Calculate the reverse difference

To calculate the reverse difference in another cell (for example, C25), select the cell and enter =MAX(0, A9-A23) then press Enter.

How it Works: If A23-A9 results in a negative number, 0 is the maximum value between the two arguments, so 0 is displayed. If the result is positive, that positive number is greater than 0 and gets displayed.
Solve Data Problems in WPS Spreadsheet

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. 1. Open your workbook: Launch WPS Spreadsheet and open your existing .xlsx file.
  2. 2. Select the cell: Click the cell where you want to calculate the positive difference.
  3. 3. Input the formula: Type =MAX(0, [Cell1]-[Cell2]) and hit Enter to instantly get your result.
Fully compatible with Microsoft Excel formulas and .xlsx files.Calculate positive differences and complex datasets accurately and quickly.Lightweight, completely free to use, and runs smoothly on older devices.
QA img-9

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.