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

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.

Aladin Akyurek

MrExcel MVP
Joined
Feb 14, 2002
Messages
85,209
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?
 

The Tamer

Well-known Member
Joined
Jun 10, 2004
Messages
520
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
 

Pekkavee

Well-known Member
Joined
May 25, 2004
Messages
1,218
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:
 

Aladin Akyurek

MrExcel MVP
Joined
Feb 14, 2002
Messages
85,209

ADVERTISEMENT

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?
 

The Tamer

Well-known Member
Joined
Jun 10, 2004
Messages
520
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.
 

Pekkavee

Well-known Member
Joined
May 25, 2004
Messages
1,218

ADVERTISEMENT

Thanks

J3:L60=I63 :p

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

Pekka
:eek: :eek:
 

Aladin Akyurek

MrExcel MVP
Joined
Feb 14, 2002
Messages
85,209
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))
 

The Tamer

Well-known Member
Joined
Jun 10, 2004
Messages
520
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:
 

Brian from Maui

MrExcel MVP
Joined
Feb 16, 2002
Messages
8,459
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
 

Forum statistics

Threads
1,148,216
Messages
5,745,436
Members
423,951
Latest member
peggrif

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
Top