Sumproduct Question

The Tamer

Well-known Member
Joined
Jun 10, 2004
Messages
520
Hi

I've forgotten my Sumproduct syntax and would be appreciative of some advice.

I need to find sales for a given manager (list of names is D3:D60), but only for certain products (list of products is J3:J60 - and if the product isn't in J, then it may be in L3:L60) :oops:

Can I do this - if so, how?

Many thanks

Tamer
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
The Tamer said:
Hi

I've forgotten my Sumproduct syntax and would be appreciative of some advice.

I need to find sales for a given manager (list of names is D3:D60), but only for certain products (list of products is J3:J60 - and if the product isn't in J, then it may be in L3:L60) :oops:

Can I do this - if so, how?

Many thanks

Tamer

What does "find sales for a given manager" mean - count them or sum them or something totally different? Where are the amounts that reprsent sales?
 
Upvote 0
And I thought I'd done such a good job of explaining!! ;)

It's basically a sum I needed. Add all the sales of a certain product if the sale was made by a certain manager. But I just got the answer.

It's (in a different Example that I used to experiment) =SUMPRODUCT((A4:B6=H8)*(C4:C6=G8)*(D4:D6))

I'd just forgotten how to phrase the SUMPRODUCT formula.

Thanks though for your help Aladin - it's always appreciated.

Tamer
 
Upvote 0
Try this to start with

=SUMPRODUCT(--(A4:A6=H8),--(C4:C6=G8),(D4:D6))+SUMPRODUCT(--(B4:B6=H8),--(C4:C6=G8),(D4:D6))

Products in A or B column, managers in C column and sales in D column.

Regards
Pekka
:eek: :eek: :eek:
 
Upvote 0
The Tamer said:
...

I just got the answer.

It's (in a different Example that I used to experiment) =SUMPRODUCT((A4:B6=H8)*(C4:C6=G8)*(D4:D6))

...

The ranges do not agree with your initial post. And, one crucial element is not covered by the formula you post - that is, the product of interest can be either in one range or the other. So, where are those sale figures?
 
Upvote 0
Aladin,

While i was waiting for an answer, I was playing around with the formula on an ultra simple spreadsheet with dummy data that i knocked up in a few seconds so that it was easy to see what I was doing. The example above is from the dummy spreadsheet, not the spreadsheet that I was having difficulty with (which I indicated in the post)

The formula for the real spreadsheet is
=SUMPRODUCT((D3:D60=D63)*(J3:L60=I63)*(M3:M60))
(Where D63 housed the name of the manager, I63 houses the name of the product and (M3 to M60) house the numbers of products sold.) J3:L60 works fine because the product name is only ever going to appear in one column or another.

Pekavee - Thanks too for your response.
 
Upvote 0
Thanks

J3:L60=I63 :p

I never knew that you can use two columns in Sumproduct this way.

Pekka
:eek: :eek:
 
Upvote 0
Pekkavee said:
Thanks

J3:L60=I63 :p

I never knew that you can use two columns in Sumproduct this way.

Pekka
:eek: :eek:

You can if you switch to the "star" syntax. That's you can mix vectors and matrices in a SumProduct formula as long as they are equally sized in one dimension.

Or in Tamer's case:

=SUMPRODUCT(--(D3:D60=D63),--((J3:J60=I63)+(L3:L60=I63)>0),M3:M60)

which is "equivalent" to but more robust:

=SUMPRODUCT((D3:D60=D63)*(J3:L60=I63)*(M3:M60))
 
Upvote 0
Aladin Akyurek said:
=SUMPRODUCT(--(D3:D60=D63),--((J3:J60=I63)+(L3:L60=I63)>0),M3:M60)
...is...more robust [than]:
=SUMPRODUCT((D3:D60=D63)*(J3:L60=I63)*(M3:M60))
Thanks Aladin - but in what way is your alternative more "robust"? In what instances will yours stand up where mine will fail? And is ther ever a situation where "*" is better than --? :confused:
 
Upvote 0
The Tamer said:
Aladin Akyurek said:
=SUMPRODUCT(--(D3:D60=D63),--((J3:J60=I63)+(L3:L60=I63)>0),M3:M60)
...is...more robust [than]:
=SUMPRODUCT((D3:D60=D63)*(J3:L60=I63)*(M3:M60))
Thanks Aladin - but in what way is your alternative more "robust"? In what instances will yours stand up where mine will fail? And is ther ever a situation where "*" is better than --? :confused:

Depending on what answer you expect, enter the data in I63 in J3, K3, and L3 for both formulas, you'll get different answers.

See also,

http://www.mrexcel.com/board2/viewtopic.php?t=125130&postdays=0&postorder=asc&start=20
 
Upvote 0

Forum statistics

Threads
1,213,552
Messages
6,114,278
Members
448,559
Latest member
MrPJ_Harper

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