In this article, we are going to learn how to calculate the sum of positive and negative numbers separately on the basis of criteria. We will use SUMIF function to sum up the positive and negative numbers.

Let’s take an example and understand:-

We have an agency’s car sales data. In data we have sales details along with discount detail. Now, we want to calculate the sum for every manufacturer sales amount and discount amount. Also, in data, discount amount is in negative numbers so we want to return the total sum of negative number as well.

**How to calculate the sum of positive numbers?**

To calculate the positive numbers, we will use SUMIF function, follow below given steps:-

- Enter the formula in cell I2
- =SUMIF($A$2:$F$17,H2,$E$2:$E$17)
- Press Enter and copy the same formula in range.

**How to add negative numbers?**

To calculate the sum of negative numbers, we will use SUMIF function. We need to follow below given steps:-

- Enter the formula in cell J2
- =SUMIF($A$2:$F$17,H2,$F$2:$F$17)
- Press Enter and copy the same formula in range.
- When we use the formula (-) sign will be deleted.
- Press Ctrl+1 format cells, and a dialog box will appear.
- Format Cells > Numbers > Custom

** **

** **

- Click on OK.

This is the way we can use SUMIF to calculate the negative and positive number in the data of Microsoft Excel.