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
SKU DescriptionMaster SKUParent/BoxSales Units
Item 1 (Parent)Item 1Parent5
Item 1 (Box 1)Item 1Box1
Item 1 (Box 2)Item 1Box2
Item 2 (Parent)Item 2Parent20
Item 2 (Box 1)Item 2Box5
Item 2 (Box 2)Item 2Box5
Item 2 (Box 3)Item 2Box6

<tbody>
</tbody>

Table 2 - Total Sales by Master SKU
Master SKUTotal Sales Units
Item 16
Item 225

<tbody>
</tbody>

Thanks in advance for your help!
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
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
Row\Col
A​
B​
C​
D​
1​
Table 1 - Raw Data
2​
SKU DescriptionMaster SKUParent/BoxSales Units
3​
Item 1 (Parent)Item 1Parent
5​
4​
Item 1 (Box 1)Item 1Box
1​
5​
Item 1 (Box 2)Item 1Box
2​
6​
Item 2 (Parent)Item 2Parent
20​
7​
Item 2 (Box 1)Item 2Box
5​
8​
Item 2 (Box 2)Item 2Box
5​
9​
Item 2 (Box 3)Item 2Box
6​
10​
11​
Table 2 - Total Sales by Master SKU
12​
Master SKUTotal Sales Units
13​
Item 1
6​
14​
Item 2
25​

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,215,059
Messages
6,122,913
Members
449,093
Latest member
dbomb1414

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