SUMIF positive & negative values

shaggy31

Board Regular
Joined
May 6, 2009
Messages
64
Office Version
  1. 365
Platform
  1. Windows
Hi,

I have a list of products in Excel with data like Product Number, Product Name, Quantity (Income/Outcome), Date, Invoice number, etc. but the first three are relevant to my case.
The table looks like this:

PNProduct nameQty (Income/Outcome)...
PN1Product1-6...
PN2Product2-2...
PN3Product3-6...
PN4Product4-6...
PN5Product5-6...
PN6Product6-6...
PN7Product7-20...
PN5Product5570...
PN1Product1-7...
PN3Product3-7...
PN4Product4-7...
PN5Product5-7...
PN6Product6-7...
PN7Product754...
.............


The positive values are Income and the negative are the Outcome of the item.

Now I would like to sum in one column Income values, and in the other one Outcome values.

For example:


PNIncomeOutcome
PN1
13​
PN2
2​
PN3
-13​
PN4
-13​
PN5
570​
13​
PN6
13​
PN7
54​
20​

I thought using formula =SUMIF($A$2:$A$218;!A2;$C$2:$C$222) and this works fine if I want to count positive and negative values together, but I don't know how to put in this formula a criteria for summing only negative or positive values as there is already a criteria that it equals "A2" .

Thanks for any help.
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
How about
Fluff.xlsm
ABCDEFGH
1PNProduct nameQty (Income/Outcome)PNIncomeOutcome
2PN1Product1-6PN1013
3PN2Product2-2PN202
4PN3Product3-6PN3013
5PN4Product4-6PN4013
6PN5Product5-6PN557013
7PN6Product6-6PN6013
8PN7Product7-20PN75420
9PN5Product5570
10PN1Product1-7
11PN3Product3-7
12PN4Product4-7
13PN5Product5-7
14PN6Product6-7
15PN7Product754
16
Sheet5
Cell Formulas
RangeFormula
G2:G8G2=SUMIFS(C:C,C:C,">0",A:A,F2)
H2:H8H2=-SUMIFS(C:C,C:C,"<0",A:A,F2)
 
Upvote 0
Solution
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top