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.
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
Sorry picture example hasn't been added so below:

ABCD
NameYearsColourPrice
1BMW5White50000
2Fiat6Black20000
3Ford3Yellow10000
4Fiat10Blue20000
5BMW6Grey30000
6Ford9Grey20000
7Ford12Grey30000
8Ford3Grey20000
9Fiat5Black30000
10Fiat8White20000
11BMW4Black40000
12….….….….
13….….….….
14….….….….
15….….….….
below is data validation
18Name _____
No of items
19Years _____
Here is outcome
20Colour _____
21Price _____

<colgroup><col span="4"><col><col></colgroup><tbody>
</tbody>
 
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

Forum statistics

Threads
1,220,965
Messages
6,157,120
Members
451,399
Latest member
alchavar

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