SUMIF Issue

Cartolo

New Member
Joined
Jun 12, 2017
Messages
5
Hi All,

I have an issue with SUMIFs. I am trying to sum up a sub group of items that use the same main component i.e. apple. However, I only want to sum up the qty leftover from the main component item such as apple that is positive with no negative values.

The reason being is that the demand is on the finished good (pies,fritters,juice) not on the component i.e. apple.

=SUMIFS(B:B,C:C,[@[Sub Group]])

Here is the data set:

A. ItemB. Qty LeftoverC. Sub GroupD. Qty of Sub GroupE. Correct Qty of Sub GrpFGHI
Apple
Apple Pie
Apple Juice
Banana
Banana Pie
Banana Fritter 4 Banana 11 11


<colgroup><col style="font-weight: bold; width: 30px;"><col style="width: 47px;"><col style="width: 47px;"><col style="width: 47px;"><col style="width: 47px;"><col style="width: 47px;"><col style="width: 47px;"><col style="width: 47px;"><col style="width: 47px;"><col style="width: 47px;"></colgroup><tbody>
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=CACACA]#CACACA[/URL] , align: center"]1[/TD]

[TD="align: right"]-20[/TD]
[TD="align: right"]Apple[/TD]
[TD="align: right"]-40[/TD]
[TD="align: right"]-20[/TD]
[TD="align: right"][/TD]

[TD="align: right"][/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=CACACA]#CACACA[/URL] , align: center"]2[/TD]

[TD="align: right"]-5[/TD]
[TD="align: right"]Apple[/TD]
[TD="align: right"]-40[/TD]
[TD="align: right"]-20[/TD]
[TD="align: right"][/TD]

[TD="align: right"][/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=CACACA]#CACACA[/URL] , align: center"]3[/TD]

[TD="align: right"]-15[/TD]
[TD="align: right"]Apple[/TD]
[TD="align: right"]-40[/TD]
[TD="align: right"]-20[/TD]
[TD="align: right"][/TD]

[TD="align: right"][/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=CACACA]#CACACA[/URL] , align: center"]4[/TD]

[TD="align: right"]4[/TD]
[TD="align: right"]Banana[/TD]
[TD="align: right"]11[/TD]
[TD="align: right"]11[/TD]
[TD="align: right"][/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=CACACA]#CACACA[/URL] , align: center"]5[/TD]

[TD="align: right"]3[/TD]
[TD="align: right"]Banana[/TD]
[TD="align: right"]11[/TD]
[TD="align: right"]11[/TD]
[TD="align: right"][/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=CACACA]#CACACA[/URL] , align: center"]6[/TD]

</tbody>
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
So in your example, Apple would equal 0 and Banana 11, exact?

=SUMIFS(B:B,C:C,"Apple",B:B,">0") You could replace "Apple" by C2 in this formula.
 
Upvote 0
Correct. Unfortunately your solution does not work, but here is the solution I found:

=SUMIF(C:C,[@[Sub Group]],B:B)-IF(SUMIF(A:A,[@[Sub Group]],B:B)<0, SUMIF(A:A,[@[Sub Group]],B:B),0)

However, this formula runs extremely slow now :(.
 
Upvote 0
Hi,

Don't use Entire Column references (i.e. C:C, B:B, etc.), that's over 1 Million rows for Excel to process.

Use a range you know is greater than your data set, if you think you'll never have more than 100000 rows of data, use 125000, like C1:C125000
 
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,871
Members
452,363
Latest member
merico17

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