How to Subtract in Excel Based on Criteria (3 Examples)

Example 1 – Subtraction of Excel Data Based on Empty Cell

Suppose we have a dataset with empty cells. We want to subtract cell values based on certain criteria using the IF function. Follow these steps:

3 Examples to Subtract in Excel Based on Criteria

  • In cell F5, enter the following formula and press Enter:
=IF(C5<>"",B5-C5,IF(D5<>"",B5-D5,IF(E5<>"",B5-E5,"")))

3 Examples to Subtract in Excel Based on Criteria

  • Use the Fill Handle (+) tool to copy the formula down to cells F6 to F10.

  • We will get the below output:

How Does the Formula Work?

This formula checks if cells C5, D5, and E5 are not empty. If any of them contain a value, it subtracts that value from B5. Otherwise, it returns an empty string.

Read More: Subtraction for Whole Column in Excel


Example 2 – Subtract When Cell Content Is Greater Than a Specific Number

Suppose we have two lists of numbers in our dataset. We want to subtract the values of Data 1 from Data 2 only when the value in Data 1 is greater than 50. Follow these steps:

3 Examples to Subtract in Excel Based on Criteria

  • In cell D5, insert the following formula and press Enter:
=IF(B5>50,C5-B5,B5)

This formula checks if the value in B5 is greater than 50. If true, it subtracts B5 from C5; otherwise, it returns the value in B5.

3 Examples to Subtract in Excel Based on Criteria

  • We will get the below output:

From the above result, we can see that when the values of Data 1 are greater than 50, the above formula subtracts the number of Data1 from those of Data 2. Otherwise, the formula returns the value of Data 1.

Read More: How to Subtract Two Columns in Excel


Example 3 – Subtract If One Cell Value Is Greater Than Another

In this method, we compare cell values and subtract based on the comparison. Assume we have data in three columns. Follow these steps:

3 Examples to Subtract in Excel Based on Criteria

  • In cell E5, insert the following formula and press Enter:
=IF(B5>C5,D5-B5,D5-C5)

Here, the IF function checks if the value in B5 is greater than C5. If true, it subtracts B5 from D5; otherwise, it subtracts C5 from D5.

3 Examples to Subtract in Excel Based on Criteria

  • Use the Fill Handle tool to autofill the formula to the other cells.
  • We will get the below results:

Read More: How to Create a Subtraction Formula in Excel


Download Practice Workbook

You can download the practice workbook from here:


Related Articles


<< Go Back to Subtract in Excel | Calculate in Excel | Learn Excel

Get FREE Advanced Excel Exercises with Solutions!
Hosne Ara
Hosne Ara

Hosne Ara is a materials and metallurgical engineer who loves exploring Excel and VBA programming. To her, programming is like a time-saving superhero for dealing with data, files, and the internet. She's skilled in Rhino3D, Maxsurf C++, MS Office, AutoCAD, and Excel & VBA, going beyond the basics. With a B. Sc. in Materials and Metallurgical Engineering from Bangladesh University of Engineering and Technology, she's shifted gears and now works as a content developer. In this role, she... Read Full Bio

We will be happy to hear your thoughts

Leave a reply

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo