Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 373
Default SUMPRODUCT - Bob Phillips

Bob, I am studying your wonderful article on sumproduct. I have this:

A B
1 Make Month
2 Ford June
3 Ford June
4 Ford May
5 Ford June
6 Renault June
7 Renault June
8 BMW June
9 BMW May
10 BMW June

The question is, how many cars were either Fords or were sold in June?
I used
=SUMPRODUCT((A1:A10="Ford")+(B1:B10="June"))
expecting to get 8. Yet, I get 11.
I was expecting + to work like logical or, but it worked like arithmetic
plus.
Did I miss something? Or, how can I fix this to get the expected answer?
James


  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 4,393
Default SUMPRODUCT - Bob Phillips

I am sure Bob will not mind if I answer:
=SUMPRODUCT((A1:A10="Ford")+(B1:B10="June")) -
SUMPRODUCT((A1:A10="Ford")*(B1:B10="June"))
best wishes
--
Bernard V Liengme
Microsoft Excel MVP
www.stfx.ca/people/bliengme
remove caps from email

"Zone" wrote in message
...
Bob, I am studying your wonderful article on sumproduct. I have this:

A B
1 Make Month
2 Ford June
3 Ford June
4 Ford May
5 Ford June
6 Renault June
7 Renault June
8 BMW June
9 BMW May
10 BMW June

The question is, how many cars were either Fords or were sold in June?
I used
=SUMPRODUCT((A1:A10="Ford")+(B1:B10="June"))
expecting to get 8. Yet, I get 11.
I was expecting + to work like logical or, but it worked like arithmetic
plus.
Did I miss something? Or, how can I fix this to get the expected answer?
James





  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 4,393
Default SUMPRODUCT - Bob Phillips

Or in shorter form
=SUMPRODUCT((A1:A10="Ford")+(B1:B10="June")-(A1:A10="Ford")*(B1:B10="June"))
--
Bernard V Liengme
Microsoft Excel MVP
www.stfx.ca/people/bliengme
remove caps from email

"Zone" wrote in message
...
Bob, I am studying your wonderful article on sumproduct. I have this:

A B
1 Make Month
2 Ford June
3 Ford June
4 Ford May
5 Ford June
6 Renault June
7 Renault June
8 BMW June
9 BMW May
10 BMW June

The question is, how many cars were either Fords or were sold in June?
I used
=SUMPRODUCT((A1:A10="Ford")+(B1:B10="June"))
expecting to get 8. Yet, I get 11.
I was expecting + to work like logical or, but it worked like arithmetic
plus.
Did I miss something? Or, how can I fix this to get the expected answer?
James



  #7   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 373
Default SUMPRODUCT - Bob Phillips

Perfect! Thanks, Bernard. Both give the correct answer. Now, this is
something for me to mull over! James

"Bernard Liengme" wrote in message
...
Or in shorter form
=SUMPRODUCT((A1:A10="Ford")+(B1:B10="June")-(A1:A10="Ford")*(B1:B10="June"))
--
Bernard V Liengme
Microsoft Excel MVP
www.stfx.ca/people/bliengme
remove caps from email

"Zone" wrote in message
...
Bob, I am studying your wonderful article on sumproduct. I have this:

A B
1 Make Month
2 Ford June
3 Ford June
4 Ford May
5 Ford June
6 Renault June
7 Renault June
8 BMW June
9 BMW May
10 BMW June

The question is, how many cars were either Fords or were sold in June?
I used
=SUMPRODUCT((A1:A10="Ford")+(B1:B10="June"))
expecting to get 8. Yet, I get 11.
I was expecting + to work like logical or, but it worked like arithmetic
plus.
Did I miss something? Or, how can I fix this to get the expected answer?
James





  #8   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10,593
Default SUMPRODUCT - Bob Phillips

Zone,

There is an example that explains this, it is because the June Fords get
double counted.

There is also a way to exclude the double-counting

=SUMPRODUCT((A1:A10="Ford")+(B1:B10="June"))-SUMPRODUCT(--(A1:A10="Ford"),--(B1:B10="June"))

I have been posting an improvement on this recently of

=SUMPRODUCT(--(((A1:A10="Ford")+(B1:B10="June"))0))

But I have a better way, which the page is currently due an update to
include, which is

=SUMPRODUCT(SIGN((A1:A10="Ford")+(B1:B10="June")))

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Zone" wrote in message
...
Bob, I am studying your wonderful article on sumproduct. I have this:

A B
1 Make Month
2 Ford June
3 Ford June
4 Ford May
5 Ford June
6 Renault June
7 Renault June
8 BMW June
9 BMW May
10 BMW June

The question is, how many cars were either Fords or were sold in June?
I used
=SUMPRODUCT((A1:A10="Ford")+(B1:B10="June"))
expecting to get 8. Yet, I get 11.
I was expecting + to work like logical or, but it worked like arithmetic
plus.
Did I miss something? Or, how can I fix this to get the expected answer?
James



  #9   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 373
Default SUMPRODUCT - Bob Phillips

Thanks, Bob! I'm sure you were making the point that sumproduct could be
used to get the total instances of cars that were either Fords or sold in
June at that point in the article. But I got stuck on the literal meaning
of "cars that were either Fords or sold in June". Now I can go back to
studying your article! Many thanks, James

"Bob Phillips" wrote in message
...
Zone,

There is an example that explains this, it is because the June Fords get
double counted.

There is also a way to exclude the double-counting

=SUMPRODUCT((A1:A10="Ford")+(B1:B10="June"))-SUMPRODUCT(--(A1:A10="Ford"),--(B1:B10="June"))

I have been posting an improvement on this recently of

=SUMPRODUCT(--(((A1:A10="Ford")+(B1:B10="June"))0))

But I have a better way, which the page is currently due an update to
include, which is

=SUMPRODUCT(SIGN((A1:A10="Ford")+(B1:B10="June")))

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my
addy)

"Zone" wrote in message
...
Bob, I am studying your wonderful article on sumproduct. I have this:

A B
1 Make Month
2 Ford June
3 Ford June
4 Ford May
5 Ford June
6 Renault June
7 Renault June
8 BMW June
9 BMW May
10 BMW June

The question is, how many cars were either Fords or were sold in June?
I used
=SUMPRODUCT((A1:A10="Ford")+(B1:B10="June"))
expecting to get 8. Yet, I get 11.
I was expecting + to work like logical or, but it worked like arithmetic
plus.
Did I miss something? Or, how can I fix this to get the expected answer?
James





  #10   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,231
Default SUMPRODUCT - Bob Phillips

"Bob Phillips" wrote...
....
But I have a better way, which the page is currently due an update to
include, which is

=SUMPRODUCT(SIGN((A1:A10="Ford")+(B1:B10="June")) )

....

Better how? It uses an extra level of nested function calls.

There are shorter array formulas.

=COUNT(1/((A1:A10="Ford")+(B1:B10="June")))




  #11   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10,593
Default SUMPRODUCT - Bob Phillips

Oh goodie, Harlan woke up grumpy for a change ...

I think it is better because it is more intuitive IMO, and one extra
function call is rarely going to make any difference.

As to your array alternative, I quote ...

True, but I meant in the sense of avoiding unnecessary follow-up and
responses when the OP failed to enter your SUM formula as an array formula.
Care to check the frequency of OPs failing to catch the 'array formula'
caveats in responses they receive?

'Course if you like the unnecessary addition back & forth . . .

Guess who said that? But I suppose you will see that as an insult in your
inimitable way.

Bob

"Harlan Grove" wrote in message
...
"Bob Phillips" wrote...
...
But I have a better way, which the page is currently due an update to
include, which is

=SUMPRODUCT(SIGN((A1:A10="Ford")+(B1:B10="June") ))

...

Better how? It uses an extra level of nested function calls.

There are shorter array formulas.

=COUNT(1/((A1:A10="Ford")+(B1:B10="June")))



  #12   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,231
Default SUMPRODUCT - Bob Phillips

"Bob Phillips" wrote...
....
I think it is better because it is more intuitive IMO, and one extra
function call is rarely going to make any difference.


You once wrote something like that about using N(..) in place of adding 0,
multiplying by 1 or double negating boolean arrays. Not much use of that
idiom anymore.

As to your array alternative, I quote ...

....

Note I didn't SUGGEST its use, only said it's shorter, which is demonstrably
true. There are still some occasions when reducing file size and recalc time
are usefule if not necessary.


  #13   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10,593
Default SUMPRODUCT - Bob Phillips


"Harlan Grove" wrote in message
...
"Bob Phillips" wrote...


You once wrote something like that about using N(..) in place of adding 0,
multiplying by 1 or double negating boolean arrays. Not much use of that
idiom anymore.



How nice, that you should follow my postings so closely, with impeccable
(you think!) recall.


Note I didn't SUGGEST its use, only said it's shorter, which is
demonstrably true. There are still some occasions when reducing file size
and recalc time are usefule if not necessary.


Yes you did, you said ...

Should have used


=SUMPRODUCT(--D2:D6)


  #14   Report Post  
Posted to microsoft.public.excel.misc
JMB JMB is offline
external usenet poster
 
Posts: 2,062
Default SUMPRODUCT - Bob Phillips

One other way you could write it:
=SUMPRODUCT(--((A1:A10="Ford")+(B1:B10="June")0))


"Zone" wrote:

Bob, I am studying your wonderful article on sumproduct. I have this:

A B
1 Make Month
2 Ford June
3 Ford June
4 Ford May
5 Ford June
6 Renault June
7 Renault June
8 BMW June
9 BMW May
10 BMW June

The question is, how many cars were either Fords or were sold in June?
I used
=SUMPRODUCT((A1:A10="Ford")+(B1:B10="June"))
expecting to get 8. Yet, I get 11.
I was expecting + to work like logical or, but it worked like arithmetic
plus.
Did I miss something? Or, how can I fix this to get the expected answer?
James



  #15   Report Post  
Posted to microsoft.public.excel.misc
JMB JMB is offline
external usenet poster
 
Posts: 2,062
Default SUMPRODUCT - Bob Phillips

Oops - I didn't read all of Bob's post. Never mind then.

"JMB" wrote:

One other way you could write it:
=SUMPRODUCT(--((A1:A10="Ford")+(B1:B10="June")0))


"Zone" wrote:

Bob, I am studying your wonderful article on sumproduct. I have this:

A B
1 Make Month
2 Ford June
3 Ford June
4 Ford May
5 Ford June
6 Renault June
7 Renault June
8 BMW June
9 BMW May
10 BMW June

The question is, how many cars were either Fords or were sold in June?
I used
=SUMPRODUCT((A1:A10="Ford")+(B1:B10="June"))
expecting to get 8. Yet, I get 11.
I was expecting + to work like logical or, but it worked like arithmetic
plus.
Did I miss something? Or, how can I fix this to get the expected answer?
James





  #16   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,572
Default SUMPRODUCT - Bob Phillips

You didn't notice that Bob posted that same formula 5 hours ago?<bg
--
Regards,

RD

---------------------------------------------------------------------------
Please keep all correspondence within the NewsGroup, so all may benefit !
---------------------------------------------------------------------------
"JMB" wrote in message
...
One other way you could write it:
=SUMPRODUCT(--((A1:A10="Ford")+(B1:B10="June")0))


"Zone" wrote:

Bob, I am studying your wonderful article on sumproduct. I have this:

A B
1 Make Month
2 Ford June
3 Ford June
4 Ford May
5 Ford June
6 Renault June
7 Renault June
8 BMW June
9 BMW May
10 BMW June

The question is, how many cars were either Fords or were sold in June?
I used
=SUMPRODUCT((A1:A10="Ford")+(B1:B10="June"))
expecting to get 8. Yet, I get 11.
I was expecting + to work like logical or, but it worked like arithmetic
plus.
Did I miss something? Or, how can I fix this to get the expected

answer?
James




  #17   Report Post  
Posted to microsoft.public.excel.misc
JMB JMB is offline
external usenet poster
 
Posts: 2,062
Default SUMPRODUCT - Bob Phillips

Nope - and I was wondering why he didn't because that's more than likely
where I got the idea. I read his post, but didn't scroll down enough to see
the rest of it (until I re-read it just to be sure).


"Ragdyer" wrote:

You didn't notice that Bob posted that same formula 5 hours ago?<bg
--
Regards,

RD

---------------------------------------------------------------------------
Please keep all correspondence within the NewsGroup, so all may benefit !
---------------------------------------------------------------------------
"JMB" wrote in message
...
One other way you could write it:
=SUMPRODUCT(--((A1:A10="Ford")+(B1:B10="June")0))


"Zone" wrote:

Bob, I am studying your wonderful article on sumproduct. I have this:

A B
1 Make Month
2 Ford June
3 Ford June
4 Ford May
5 Ford June
6 Renault June
7 Renault June
8 BMW June
9 BMW May
10 BMW June

The question is, how many cars were either Fords or were sold in June?
I used
=SUMPRODUCT((A1:A10="Ford")+(B1:B10="June"))
expecting to get 8. Yet, I get 11.
I was expecting + to work like logical or, but it worked like arithmetic
plus.
Did I miss something? Or, how can I fix this to get the expected

answer?
James





Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
to Bob Phillips Jack Sons Excel Discussion (Misc queries) 15 August 28th 07 02:51 PM
Question to Bob Phillips (or whoever...) vezerid Excel Worksheet Functions 5 December 11th 05 11:44 AM
ATTN: Mr. Bob Phillips Danny Excel Worksheet Functions 1 August 24th 05 11:46 PM
For Bob Phillips D.J.Shaw Excel Worksheet Functions 5 August 3rd 05 01:20 AM
PING Bob Phillips Steve Excel Discussion (Misc queries) 3 July 4th 05 07:31 PM


All times are GMT +1. The time now is 09:28 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"