Excel Formula to Return Zero If Negative Value is Found

Suppose we have a dataset of the amounts of two items and the Differences between them. There are some negative numeric values. Let’s change each negative value to zero using formulas and formatting.

Perform If Negative Then Zero with Excel Formula


Method 1 – Using IF Function

Although the values in the Differences column have been created using a formula, we can wrap the formula inside an IF function to convert the values to zero. The IF function runs a condition over a given statement and returns an output based on the condition.

Steps:

  • In cell D5, enter the following formula:
=IF(B5-C5<0,0,B5-C5)

Use IF Function to Input Zero If Negative with Excel Formula

  • Press Enter.
  • Drag the Fill Handle down to fill all the cells below.

The positive values remain the same but the negative values have been converted into zeros.

Perform If Negative Then Zero with Excel Formula

Read More: Excel Formula If Cell Contains Negative Number


Method 2 – Using MAX Function

Steps:

  • In cell D5 enter the following formula:
=MAX(B5-C5,0)

The MAX function returns the largest value within a statement.

  • Press Enter to return the result.
  • Drag the Fill Handle down to fill all the cells below.

Perform If Negative Then Zero with Excel Formula

The negative values are converted to zero.

Perform If Negative Then Zero with Excel Formula

Read More: Excel Formula to Return Blank If Cell Value Is Negative


Method 3 – Using Format Cells Feature

In some cases, instead of a formula we can format cells to display negative values as zeroes.

Steps:

  • Select the range D5:D14.
  • While the cells are selected, press Ctrl+1 to open the Format Cells dialog box.

Utilize Format Cells Feature to Perform If Negative Then Zero

  • In the dialog box select “Custom”.
  • In the Type box enter #,##0;”0”.
  • Click OK.

  • Negative values are converted to zeroes.

Perform If Negative Then Zero with Excel Formula


Download Practice Workbook


Things to Remember

  • The format cells feature will change the format but not the values.

Related Articles


<< Go Back to Negative Numbers in Excel | Number Format | Learn Excel

Get FREE Advanced Excel Exercises with Solutions!
Wasim Akram
Wasim Akram

Wasim Akram holds a BSc degree in Industrial and Production Engineering from Ahsanullah University of Science and Technology. Over the past 2 years, he has been actively contributing to the ExcelDemy project, where he has authored more than 150 articles. Now, he is working as an Excel VBA and Content Developer. He likes learning new things about Microsoft Office, especially Excel VBA, Power Query, Data Analysis, and Excel Statistics. He is also very interested in machine learning and... Read Full Bio

We will be happy to hear your thoughts

Leave a reply

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo