Advanced Sumproduct and combinations with IFs for every options

marcin242

New Member
Joined
Mar 18, 2016
Messages
2
The below is not so simple as you may think of.

Here is example of table. Initial has 80K of records and many columns.


-- removed inline image ---



I would like to sumporduct to count items from table but is not standard easy sumproduct I want.
Basically I want to sumproduct to count 4 conditions but….in data validation I have also All Names/All Years/All Colours/All Price.
If in cell Name I select e.g. "All Names" sumproduct needs to count the rest of conditions selected but except "Name" in the column. E.g. count how many cars are: 'black' in price '20000' and for Year of '6'.

If Some Name is selected along with the rest of 3 conditions it counts all 4 conditions.
Similar if name is selected and Colour too, 2 remaining are set to all, sumproduct counts only for 2 (years and price).
I know that it can be done but with over 10 IFs formulas plus sumproduct…for every possibility/combination between 4 options.
Is there any easier way to do it?e.g.

=sumproduct((if(sumproduct(--(A1:A15))=0,1,"(A1:A15)")*(if(sumproduct(--(B1:B15))=0,1,"(B1:B15)"))*........

The above is in my mind but ifs put it as a text and it doesn't work like this and not sure if I can put 0 and 1 in the formula to count correctly.

I would be very very appreciated to see what excel experts can come up with.
 
Sorry picture example hasn't been added so below:

[TABLE="width: 399"]
<colgroup><col span="4"><col><col></colgroup><tbody>[TR]
[TD] [/TD]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[TD]D[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD] [/TD]
[TD]Name[/TD]
[TD]Years[/TD]
[TD]Colour[/TD]
[TD]Price[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD="align: right"]1[/TD]
[TD]BMW[/TD]
[TD]5[/TD]
[TD]White[/TD]
[TD]50000[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD="align: right"]2[/TD]
[TD]Fiat[/TD]
[TD]6[/TD]
[TD]Black[/TD]
[TD]20000[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD="align: right"]3[/TD]
[TD]Ford[/TD]
[TD]3[/TD]
[TD]Yellow[/TD]
[TD]10000[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD="align: right"]4[/TD]
[TD]Fiat[/TD]
[TD]10[/TD]
[TD]Blue[/TD]
[TD]20000[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD="align: right"]5[/TD]
[TD]BMW[/TD]
[TD]6[/TD]
[TD]Grey[/TD]
[TD]30000[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD="align: right"]6[/TD]
[TD]Ford[/TD]
[TD]9[/TD]
[TD]Grey[/TD]
[TD]20000[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD="align: right"]7[/TD]
[TD]Ford[/TD]
[TD]12[/TD]
[TD]Grey[/TD]
[TD]30000[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD="align: right"]8[/TD]
[TD]Ford[/TD]
[TD]3[/TD]
[TD]Grey[/TD]
[TD]20000[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD="align: right"]9[/TD]
[TD]Fiat[/TD]
[TD]5[/TD]
[TD]Black[/TD]
[TD]30000[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD="align: right"]10[/TD]
[TD]Fiat[/TD]
[TD]8[/TD]
[TD]White[/TD]
[TD]20000[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD="align: right"]11[/TD]
[TD]BMW[/TD]
[TD]4[/TD]
[TD]Black[/TD]
[TD]40000[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD="align: right"]12[/TD]
[TD]….[/TD]
[TD]….[/TD]
[TD]….[/TD]
[TD]….[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD="align: right"]13[/TD]
[TD]….[/TD]
[TD]….[/TD]
[TD]….[/TD]
[TD]….[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD="align: right"]14[/TD]
[TD]….[/TD]
[TD]….[/TD]
[TD]….[/TD]
[TD]….[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD="align: right"]15[/TD]
[TD]….[/TD]
[TD]….[/TD]
[TD]….[/TD]
[TD]….[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[/TR]
[TR]
[TD] [/TD]
[TD] [/TD]
[TD] below is data validation
[/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[/TR]
[TR]
[TD="align: right"]18[/TD]
[TD]Name[/TD]
[TD] _____
[/TD]
[TD] [/TD]
[TD="colspan: 2"]No of items[/TD]
[/TR]
[TR]
[TD="align: right"]19[/TD]
[TD]Years[/TD]
[TD] _____
[/TD]
[TD] [/TD]
[TD="colspan: 2"] Here is outcome
[/TD]
[/TR]
[TR]
[TD="align: right"]20[/TD]
[TD]Colour[/TD]
[TD] _____
[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD="align: right"]21[/TD]
[TD]Price[/TD]
[TD] _____
[/TD]
[TD] [/TD]
[/TR]
[TR]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[/TR]
[TR]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[/TR]
[TR]
[TD] [/TD]
[TD] [/TD]
[TD][/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[/TR]
[TR]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[/TR]
[TR]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[/TR]
</tbody>[/TABLE]
 
Upvote 0
Welcome to the MrExcel board!

Here are two formulas that I think do what you are asking, COUNTIFS as suggested by Ford, & SUMPRODUCT that you were trying.

Excel Workbook
ABCD
1NameYearsColourPrice
2BMW5White50000
3Fiat6Black20000
4Ford3Yellow10000
5Fiat10Blue20000
6BMW6Grey30000
7Ford9Grey20000
8Ford12Grey30000
9Ford3Grey20000
10Fiat5Black30000
11Fiat8White20000
12BMW4Black40000
13
14
15
16NameFordNo of items
17YearsAll Years3
18ColourGrey3
19PriceAll Prices
Count
 
Upvote 0

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