Replace Negative Values with Zero in Excel & Google Sheets

Written by

Editorial Team

Reviewed by

Steve Rynearson

Last updated on February 7, 2023
Download Example Workbook

Download the example workbook

In this tutorial we will demonstrate how to replace negative numbers with zeros in Excel & Google Sheets.

Negative Numbers to Zero Main

Replace Negative Numbers with Zero

Sometimes you don’t want negative values in your data. You can replace negative values with zero using one of the following three methods.

MAX Function

The MAX Function returns the maximum value from a set of numbers. Here we will use the MAX Function to calculate the max value between 0 and a calculated value.

For example, we have a table with heights values in Column B and C. Now, we need to calculate the difference between Heights 1 and Heights 2 but would like the results to only show positive values and replace the negative values with zero. So to do that, we used the following formula:

=MAX(B3-C3,0)

Negative Numbers to Zero With MAX f

IF Function

We can also use the IF function to force negative numbers to zero. The IF function tests a condition and returns a value depending on whether the condition is true or false.

Let’s say we have a set of data in column B with positive and negative values. Now, we need only positive numbers to show in column C.

To do this, we put the following formula in Cell C3 and autofill the rest of the cells:

=IF(B3<0,0,B3)

Negative Numbers to Zero With IF f

Display Negative Values as Zeros

The above two methods not only display the negative value as zero but also changes the value to zero.

Instead, we can change the number formatting to 0;”0”;0. This will display negative numbers as zero.

Note: We use this method with extreme caution. It can cause great confusion in your workbook!

Custom Formatting 1

Change Number Formatting

  1. Select a range of cells
  2. Press CTLR+1 to access the Number Format Dialog Box.
  3. Select Custom
  4. Type 0;”0”;0 in the Type box and click the OK button

Negative Numbers to Zero with Formatting 2

This changes the display of all the negative values to zero, maintaining the original cell value.

Custom Formatting 2

Replace Negative Numbers to Zero in Google Sheets

The formula to replace negative numbers to zero works exactly the same in Google Sheets as in Excel:

Negative Numbers to Zero Google Sheets

AI Formula Generator

Try for Free

Excel Practice Worksheet

practice excel worksheet

Practice Excel functions and formulas with our 100% free practice worksheets!

  • Automatically Graded Exercises
  • Learn Excel, Inside Excel!

Free Download

Return to Excel Formulas List