Hi,
I have a list of sales data for a range of products sorted with respective attributes such as flavour, filling size, etc. These products (drinks) are normally packaged by unique flavour which makes counting sales units by flavour very easy by simply specifying the criteria in either sumproduct or sumif. However, in some packages the product flavours are mixed which is then denoted in the sales data attribute as "mix". I have a separate info table representing the flavour split per package (product code) by percent.
I would like to be able to sum the sales units by referencing a flavour (eg. Chocolate) and if an attribute is listed as "mix" I want it to lookup the product code and multiply the sales units with the respective percentage for the mixed package.
I have tried, without success, to combine SUMPRODUCT with the likes of Index & Match but the match function does not seem to work with arrays particularly well. I have played around with it quite a bit by adding separate columns but am not too keen on adding more columns to the sales data.
Here is an example of what it is I would like to achieve:
Sales Data
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]Product Code[/TD]
[TD]Flavour[/TD]
[TD]Sales Units[/TD]
[/TR]
[TR]
[TD]xxx[/TD]
[TD]chocolate[/TD]
[TD]150[/TD]
[/TR]
[TR]
[TD]yyy[/TD]
[TD]strawberry[/TD]
[TD]230[/TD]
[/TR]
[TR]
[TD]zzz[/TD]
[TD]banana[/TD]
[TD]98[/TD]
[/TR]
[TR]
[TD]aaa[/TD]
[TD]mix[/TD]
[TD]110[/TD]
[/TR]
[TR]
[TD]bbb[/TD]
[TD]mix[/TD]
[TD]120[/TD]
[/TR]
[TR]
[TD]ccc[/TD]
[TD]mix[/TD]
[TD]85[/TD]
[/TR]
[TR]
[TD]xxx[/TD]
[TD]chocolate[/TD]
[TD]113[/TD]
[/TR]
[TR]
[TD]yyy[/TD]
[TD]strawberry[/TD]
[TD]160[/TD]
[/TR]
[TR]
[TD]aaa[/TD]
[TD]mix[/TD]
[TD]65[/TD]
[/TR]
</tbody>[/TABLE]
Mix Package Info
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD="align: center"]Product Code[/TD]
[TD="align: center"]Chocolate[/TD]
[TD="align: center"]Strawberry[/TD]
[TD="align: center"]Banana[/TD]
[/TR]
[TR]
[TD]aaa[/TD]
[TD="align: center"]50%[/TD]
[TD="align: center"]20%[/TD]
[TD="align: center"]30%[/TD]
[/TR]
[TR]
[TD]bbb[/TD]
[TD="align: center"]45%[/TD]
[TD="align: center"]45%[/TD]
[TD="align: center"]10%[/TD]
[/TR]
[TR]
[TD]ccc[/TD]
[TD="align: center"]30%[/TD]
[TD="align: center"]25%[/TD]
[TD="align: center"]45%[/TD]
[/TR]
</tbody>[/TABLE]
I would then like to sum the total units by referencing a flavour.
All advice is welcome. Thanks!
I have a list of sales data for a range of products sorted with respective attributes such as flavour, filling size, etc. These products (drinks) are normally packaged by unique flavour which makes counting sales units by flavour very easy by simply specifying the criteria in either sumproduct or sumif. However, in some packages the product flavours are mixed which is then denoted in the sales data attribute as "mix". I have a separate info table representing the flavour split per package (product code) by percent.
I would like to be able to sum the sales units by referencing a flavour (eg. Chocolate) and if an attribute is listed as "mix" I want it to lookup the product code and multiply the sales units with the respective percentage for the mixed package.
I have tried, without success, to combine SUMPRODUCT with the likes of Index & Match but the match function does not seem to work with arrays particularly well. I have played around with it quite a bit by adding separate columns but am not too keen on adding more columns to the sales data.
Here is an example of what it is I would like to achieve:
Sales Data
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]Product Code[/TD]
[TD]Flavour[/TD]
[TD]Sales Units[/TD]
[/TR]
[TR]
[TD]xxx[/TD]
[TD]chocolate[/TD]
[TD]150[/TD]
[/TR]
[TR]
[TD]yyy[/TD]
[TD]strawberry[/TD]
[TD]230[/TD]
[/TR]
[TR]
[TD]zzz[/TD]
[TD]banana[/TD]
[TD]98[/TD]
[/TR]
[TR]
[TD]aaa[/TD]
[TD]mix[/TD]
[TD]110[/TD]
[/TR]
[TR]
[TD]bbb[/TD]
[TD]mix[/TD]
[TD]120[/TD]
[/TR]
[TR]
[TD]ccc[/TD]
[TD]mix[/TD]
[TD]85[/TD]
[/TR]
[TR]
[TD]xxx[/TD]
[TD]chocolate[/TD]
[TD]113[/TD]
[/TR]
[TR]
[TD]yyy[/TD]
[TD]strawberry[/TD]
[TD]160[/TD]
[/TR]
[TR]
[TD]aaa[/TD]
[TD]mix[/TD]
[TD]65[/TD]
[/TR]
</tbody>[/TABLE]
Mix Package Info
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD="align: center"]Product Code[/TD]
[TD="align: center"]Chocolate[/TD]
[TD="align: center"]Strawberry[/TD]
[TD="align: center"]Banana[/TD]
[/TR]
[TR]
[TD]aaa[/TD]
[TD="align: center"]50%[/TD]
[TD="align: center"]20%[/TD]
[TD="align: center"]30%[/TD]
[/TR]
[TR]
[TD]bbb[/TD]
[TD="align: center"]45%[/TD]
[TD="align: center"]45%[/TD]
[TD="align: center"]10%[/TD]
[/TR]
[TR]
[TD]ccc[/TD]
[TD="align: center"]30%[/TD]
[TD="align: center"]25%[/TD]
[TD="align: center"]45%[/TD]
[/TR]
</tbody>[/TABLE]
I would then like to sum the total units by referencing a flavour.
All advice is welcome. Thanks!
Last edited: