SUM If Adjacent Values Are Unique

L

Legacy 143009

Guest
Hi,

[TABLE="class: grid, width: 600"]
<tbody>[TR]
[TD]PRODUCTS[/TD]
[TD] LOT NO.[/TD]
[TD]ERROR TYPE[/TD]
[TD]ERROR COUNT[/TD]
[TD]TOTAL LOT QT.[/TD]
[/TR]
[TR]
[TD]PRODUCT1[/TD]
[TD]1[/TD]
[TD]ERROR1[/TD]
[TD]2[/TD]
[TD]200[/TD]
[/TR]
[TR]
[TD]PRODUCT1[/TD]
[TD]1[/TD]
[TD]ERROR2[/TD]
[TD]3[/TD]
[TD]200[/TD]
[/TR]
[TR]
[TD]PRODUCT1[/TD]
[TD]1[/TD]
[TD]ERROR3[/TD]
[TD]5[/TD]
[TD]200[/TD]
[/TR]
[TR]
[TD]PRODUCT1[/TD]
[TD]2[/TD]
[TD]ERROR1[/TD]
[TD]2[/TD]
[TD]500[/TD]
[/TR]
</tbody>[/TABLE]

I have a similar table to follow production errors. To be able to create a graph later, I don't use a Pivot Table to report this data.

So have another table to show error percentages. One sample cell is given below to represent it:

[TABLE="class: grid, width: 600"]
<tbody>[TR]
[TD]PRODUCTS[/TD]
[TD]ERROR1[/TD]
[TD]ERROR2[/TD]
[TD]ERROR3[/TD]
[/TR]
[TR]
[TD]PRODUCT1[/TD]
[TD]=SUMIFS(ERROR COUNT, PRODUCTS, THIS PRODUCT, ERROR TYPE, THIS ERROR)/SUMIF(PRODUCTS, THIS PRODUCT, TOTAL LOT QT)*100[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]PRODUCT2[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]PRODUCT3[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]PRODUCT4[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

..and same for the other products and errors.

For ERROR1, the formula above will calculate "4/1100*100" but this is not I want. In fact, the first 3 record line belong to the same LOT NUMBER. So 200 is the same quantity for different ERROR records.

Last of all, the right calculation, for intance speaking about ERROR1, should be "4/700*100". Total amount of product entered to my depot is totally 700 actually.

Now, somewhere in the denominator section I have to say "Sum if LOT Numbers are distinctive".

Waiting for your helps. Have a nice day fellas!
 
Last edited by a moderator:

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
@Flashbond, given your syntax, it looks to me like you'd want this:

=SUMIFS(ERROR COUNT, PRODUCTS, THIS PRODUCT, ERROR TYPE, THIS ERROR)/SUMIFS(TOTAL LOT QT, PRODUCTS, THIS PRODUCT, ERROR TYPE, THIS ERROR)*100
 
Upvote 0
Nope, let's assume the last line of the first table is ERROR2. My formula will calculate "2/1100*100". Your formula will calculate "2/200*100". What I want is "2/700*100".
 
Upvote 0
Yes, I see. Try this:

=SUMIFS(ERROR COUNT, PRODUCTS, THIS PRODUCT, ERROR TYPE, THIS ERROR)/SUMPRODUCT((PRODUCTS=THIS PRODUCT)*(1/COUNTIF(LOT NO., LOT NO.))*(TOTAL LOT QT.))*100
 
Upvote 0
Yes, I am not with my PC but this might seem to be work. I know the right fonction is sumproduct but I don't know exactly how to use it. I'll try ASAP. Is this an array function?
 
Last edited by a moderator:
Upvote 0
Hi,

Is that what you were looking for?

=SUMPRODUCT(--($C$2:$C$5&B2=C2&B2),$D$2:$D$5)/SUMPRODUCT(--($C$2:$C$5&B2=C2&B2),$E$2:$E$5)*100
 
Upvote 0
Yes, I see. Try this:

=SUMIFS(ERROR COUNT, PRODUCTS, THIS PRODUCT, ERROR TYPE, THIS ERROR)/SUMPRODUCT((PRODUCTS=THIS PRODUCT)*(1/COUNTIF(LOT NO., LOT NO.))*(TOTAL LOT QT.))*100
Yes, this is the right formula! Thanks :)
 
Upvote 0
I don't want to keep alive this post but I have one question about SUMPRODUCT. It needs a specific range of values like "C1:C64" But I need a solution for general usage because I am keeping mounthly tracks on seperate spread sheets, so my row counts vary. Can anyone provide a solution can be apllied generally? Thanks
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,284
Members
452,630
Latest member
OdubiYouth

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