Sumif, Min & Matching Cells

l_doherty

New Member
Joined
Apr 13, 2018
Messages
2
Hi Guys,

I need some help finding a formula that will give me the total sales units of an item where I need to add the sales units of the "Parent" and the minimum sales units of the "Box" that relate to the item.

For example below, Item 1 is the sum of Item 1 (Parent) + minimum of (Item 1 Box 1) and (Item 1 Box 2), therefore 5 + 1 = 6.

I would like to display the totals by Master SKU in a separate table, as shown in Table 2.

Is there a forumula where I can use the "Master SKU" column and the "Parent/Box" column that will give me the correct answer?

Table 1 - Raw Data
[TABLE="width: 500"]
<tbody>[TR]
[TD]SKU Description[/TD]
[TD]Master SKU[/TD]
[TD]Parent/Box[/TD]
[TD]Sales Units[/TD]
[/TR]
[TR]
[TD]Item 1 (Parent)[/TD]
[TD]Item 1[/TD]
[TD]Parent[/TD]
[TD]5[/TD]
[/TR]
[TR]
[TD]Item 1 (Box 1)[/TD]
[TD]Item 1[/TD]
[TD]Box[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]Item 1 (Box 2)[/TD]
[TD]Item 1[/TD]
[TD]Box[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD]Item 2 (Parent)[/TD]
[TD]Item 2[/TD]
[TD]Parent[/TD]
[TD]20[/TD]
[/TR]
[TR]
[TD]Item 2 (Box 1)[/TD]
[TD]Item 2[/TD]
[TD]Box[/TD]
[TD]5[/TD]
[/TR]
[TR]
[TD]Item 2 (Box 2)[/TD]
[TD]Item 2[/TD]
[TD]Box[/TD]
[TD]5[/TD]
[/TR]
[TR]
[TD]Item 2 (Box 3)[/TD]
[TD]Item 2[/TD]
[TD]Box[/TD]
[TD]6[/TD]
[/TR]
</tbody>[/TABLE]

Table 2 - Total Sales by Master SKU
[TABLE="width: 500"]
<tbody>[TR]
[TD]Master SKU[/TD]
[TD]Total Sales Units[/TD]
[/TR]
[TR]
[TD]Item 1[/TD]
[TD]6[/TD]
[/TR]
[TR]
[TD]Item 2[/TD]
[TD]25[/TD]
[/TR]
</tbody>[/TABLE]

Thanks in advance for your help!
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
Hi,

If you can add the Box # to Parent/Box column in Table 1, it's much simpler, like below:


Excel 2010
ABCD
1SAMPLE 1
2SKU DescriptionMaster SKUParent/BoxSales Units
3Item 1 (Parent)Item 1Parent5
4Item 1 (Box 1)Item 1Box 11
5Item 1 (Box 2)Item 1Box 22
6Item 2 (Parent)Item 2Parent20
7Item 2 (Box 1)Item 2Box 15
8Item 2 (Box 2)Item 2Box 25
9Item 2 (Box 3)Item 2Box 36
10
11Master SKUTotal Sales Units
12Item 16
13Item 225
Sheet16
Cell Formulas
RangeFormula
B12=SUMPRODUCT((B$3:B$9=A12)*(C$3:C$9={"Parent","Box 1"})*D$3:D$9)


B12 formula copied down.
 
Upvote 0
[Table="width:, class:grid"][tr][td]Row\Col[/td][td]
A​
[/td][td]
B​
[/td][td]
C​
[/td][td]
D​
[/td][/tr][tr][td]
1​
[/td][td]Table 1 - Raw Data[/td][td][/td][td][/td][td][/td][/tr]
[tr][td]
2​
[/td][td]SKU Description[/td][td]Master SKU[/td][td]Parent/Box[/td][td]Sales Units[/td][/tr]
[tr][td]
3​
[/td][td]Item 1 (Parent)[/td][td]Item 1[/td][td]Parent[/td][td]
5​
[/td][/tr]
[tr][td]
4​
[/td][td]Item 1 (Box 1)[/td][td]Item 1[/td][td]Box[/td][td]
1​
[/td][/tr]
[tr][td]
5​
[/td][td]Item 1 (Box 2)[/td][td]Item 1[/td][td]Box[/td][td]
2​
[/td][/tr]
[tr][td]
6​
[/td][td]Item 2 (Parent)[/td][td]Item 2[/td][td]Parent[/td][td]
20​
[/td][/tr]
[tr][td]
7​
[/td][td]Item 2 (Box 1)[/td][td]Item 2[/td][td]Box[/td][td]
5​
[/td][/tr]
[tr][td]
8​
[/td][td]Item 2 (Box 2)[/td][td]Item 2[/td][td]Box[/td][td]
5​
[/td][/tr]
[tr][td]
9​
[/td][td]Item 2 (Box 3)[/td][td]Item 2[/td][td]Box[/td][td]
6​
[/td][/tr]
[tr][td]
10​
[/td][td][/td][td][/td][td][/td][td][/td][/tr]
[tr][td]
11​
[/td][td]Table 2 - Total Sales by Master SKU[/td][td][/td][td][/td][td][/td][/tr]
[tr][td]
12​
[/td][td]Master SKU[/td][td]Total Sales Units[/td][td][/td][td][/td][/tr]
[tr][td]
13​
[/td][td]Item 1[/td][td]
6​
[/td][td][/td][td][/td][/tr]
[tr][td]
14​
[/td][td]Item 2[/td][td]
25​
[/td][td][/td][td][/td][/tr]
[/table]


In B13 enter and copy down:

Either...

=SUM(SUMIFS($D$3:$D$9,$B$3:$B$9,$A13,$C$3:$C$9,"parent"),MINIFS($D$3:$D$9,$B$3:$B$9,$A13,$C$3:$C$9,"box"))

Or...

=SUM(VLOOKUP($A13&"*parent*",$A$3:$D$9,4,0),MINIFS($D$3:$D$9,$B$3:$B$9,$A13,$C$3:$C$9,"box"))

The foregoing requires that MINIFS is available on your system.

Otherwise control+shift+enter, not just enter, and copy down:

Or...

=SUM(SUMIFS($D$3:$D$9,$B$3:$B$9,$A13,$C$3:$C$9,"parent"),MIN(IF($B$3:$B$9=$A13,IF($C$3:$C$9="box",$D$3:$D$9))))

Or...

=SUM(VLOOKUP($A13&"*parent*",$A$3:$D$9,4,0),MIN(IF($B$3:$B$9=$A13,IF($C$3:$C$9="box",$D$3:$D$9))))
 
Upvote 0
Hi,

Thanks so much to both of you for posting solutions.

The one that I found worked the best was =SUM(SUMIFS($D$3:$D$9,$B$3:$B$9,$A13,$C$3:$C$9,"parent"),MIN(IF($B$3:$B$9=$A13,IF($C$3:$C$9="box",$D$3:$D$9))))


 
Upvote 0
Hi Guys,

I need some help finding a formula that will give me the total sales units of an item where I need to add the sales units of the "Parent" and the minimum sales units of the "Box" that relate to the item.

For example below, Item 1 is the sum of Item 1 (Parent) + minimum of (Item 1 Box 1) and (Item 1 Box 2), therefore 5 + 1 = 6.

I would like to display the totals by Master SKU in a separate table, as shown in Table 2.

Is there a forumula where I can use the "Master SKU" column and the "Parent/Box" column that will give me the correct answer?

Thanks in advance for your help!

Hi!

Another way (if possible):

Use only Enter to enter the formula

=SUM(AGGREGATE({14;15},6,$D$3:$D$9/(B$3:B$9=A16),1))

Markmzz
 
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