30 Advanced Excel Tips for 2026

Excel Champs / Excel Formulas List / IF Negative Then Zero (0) – (Formula in Excel)
By Puneet Gogia (Microsoft MVP)

IF Negative Then Zero (0) – (Formula in Excel)

30+ Advanced Excel Tips for 2026

No spam. Only Excel Stuff. God Promise. 😊

To return zero instead of a negative number, use =IF(A2-B2<0,0,A2-B2). The condition checks the result, returns 0 when it’s negative, and returns the actual figure otherwise. A shorter version that does exactly the same thing is =MAX(A2-B2,0) — MAX picks the larger of the two, so anything below zero gets replaced by the zero.

For a single cell rather than a calculation, =MAX(A1,0) works the same way. If you only want to display zeros while keeping the real negative values intact for later calculations, skip the formula and use custom formatting: select the cells, press Ctrl+1, choose Custom, and enter 0;"0";0.

And if you want the negative cells to appear empty rather than showing 0, use =IF(A2-B2<0,"",A2-B2) — just remember that returns text, so it will break any SUM that includes it.

Let me share an example with you. In the following table, you have two lists of numbers in columns A and B. And in column C, you have the difference between both.

table-with-negative-values

In Excel, a formula based on conditional logic can return a zero for any negative number in a cell or range of cells. So in this tutorial, we look at all the different ways to write a formula to convert negative numbers into zeros.

Convert Negative Numbers using IF

The first method is to use the IF function, which allows you to create a condition to check if a number is negative and then convert that number into a zero.

convert-negative-number

Use the following steps.

  1. Enter the IF function in cell C2.
  2. Specify the subtraction formula, A2 minus B2, and use the less than sign (<) with zero to create a condition.
  3. For the value_if_true, specify zero. And for the value_if_false, enter the subtraction formula that you have used in the condition.
  4. Enter the closing parenthesis and hit Enter to get the result.

By using the above steps, you have written a formula that subtracts two values and tests the result.

=IF(A2-B2<0,0,A2-B2)

The IF part of the formula checks if the result of this subtraction is less than 0. If it is, the formula will return 0. It is useful to avoid negative results appearing in your calculations. For example, if you’re calculating profits and costs, a negative result could suggest a loss, but in some contexts, you may treat that loss simply as a zero gain rather than a negative number.

If the subtraction result is not less than 0, i.e., if it’s either zero or a positive number, then the formula will return that result. This part of the formula ensures that positive differences between the values in cells A2 and B2 are accurately reflected in the result.

And if you want to show a blank cell instead of a zero for negative results, use an empty string (“”) in the value_if_true:

=IF(A2-B2<0,"",A2-B2)

Change Negative Numbers into a Zero with MAX Function

Alternatively, you can use the MAX function to ensure that all negative values are shown as zero. Let’s take the same example.

change-negative-numbers-to-zero
=MAX(A2-B2,0)

In the above formula, you have used the MAX function, where one argument is the subtraction formula of B2 from A2 and the second one is a zero.

Let’s understand it this way: the MAX function returns the maximum value from multiple values. When the result of the subtraction is a positive number, it returns that number, but if the result is a negative number, it returns zero. As a result, any negative number becomes zero, and positive numbers remain unchanged.

Show a Zero for a Negative Number

You can also use custom formatting to show a zero for a negative number. This means if you only need to display negative numbers as zero but keep the actual data unchanged, you can use the below steps to apply it.

  1. Select a cell or range of cells. Press the shortcut key Control + 1 (Command + 1 if you are using a Mac) to open the Format Cells dialog box.
  2. Click Custom in the Category list and enter 0;”0″;0 in the Type box. Click OK to apply the settings.
zero-for-negative-numbers

The first part (0) specifies how positive numbers should appear, the second part (“0”) specifies how negative numbers should appear, and the third part (0) specifies how zeros should appear. It changes only the formatting, not the value. The original value stays intact.

Keep two things in mind with this method. First, the format 0 shows whole numbers only, so 12.5 shows as 13; use 0.00;”0.00″;0.00 to keep two decimals. Second, as the negative values are still there, SUM and other formulas still include them, even though the cells show 0.

Sum Only the Positive Values

If your goal is a total that ignores negative numbers, you don’t need a helper column. Use SUMIF with the condition “>0” on the column with the differences:

=SUMIF(C2:C10,">0")

For example, for the differences -15, 18 and 0, SUM returns 3, but SUMIF returns 18, which is the same as adding up the results of the IF or MAX formula.

Convert a Whole Range in One Formula

In Excel for Microsoft 365 and Excel 2021, you can convert a whole column of values with one formula. The following formula spills the results down the column, with a zero for each negative value. Note that MAX doesn’t work this way, as it returns a single value for the whole range:

=IF(C2:C10<0,0,C2:C10)

In older versions, enter the IF formula in the first cell and drag it down with the fill handle.

Frequently Asked Questions

Why does my formula return the #VALUE! error?

One of the cells in the subtraction has text, like a number stored as text with a space or a dash. Fix the source value, or check it with ISNUMBER. Empty cells are fine, as Excel treats them as 0.

Should I use IF or MAX?

Both give the same result. MAX is shorter as you write the calculation only once. IF is better when you want something other than zero for negative values, like a blank or a text label.

How do I change negative numbers to zero without a formula?

Use the IF or MAX formula in a helper column, then copy the results and paste them back as values (Home ➜ Paste ➜ Values). If you only want to hide them, use the custom number format shown above.

Puneet Gogia

Written by

Puneet Gogia

Microsoft MVP — Excel · Founder, Excel Champs

Twelve years of teaching Excel, and a decade before that using it as a data analyst. Every tutorial here is written from a file I actually built.

3M+ readers helped
1,000+ tutorials written
Since 2015 teaching Excel

1 thought on “IF Negative Then Zero (0) – (Formula in Excel)”

  1. Allotted time 08:00 actual time 07:00 [show negative hours in formula

    Reply

Leave a Comment