#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,388
Default Sumproduct

Hi,

Consider the following examples of the same Sumproduct formula all similarly
constructed:-

=SUMPRODUCT(N($A$1:$A$20="This")*N($B$1:$B$20="Tha t"))
=SUMPRODUCT(($A$1:$A$20="This")^1*($B$1:$B$20="Tha t")^1)
=SUMPRODUCT(($A$1:$A$20="This")+0*($B$1:$B$20="Tha t")+0)
=SUMPRODUCT(($A$1:$A$20="This")*1*($B$1:$B$20="Tha t")*1)
=SUMPRODUCT(($A$1:$A$20="This")*($B$1:$B$20="That" ))

All the above work perfectly well and I understand that the first 4 coerce
the True/False evaluation to 1 & 0.
What I don't understand is when would each be selected in preference to the
other and why bother at all when the 5th example works perfectly well.

In my simple (and probably incorrectly advised) world the only time I would
resort to one of the first 4 would be for a formula like:-
=SUMPRODUCT(--($A$1:$A$20="This"))
Because
=SUMPRODUCT(($A$1:$A$20="This"))
would fail but having selected the double unary (as most seem to do) why not
the N switch or ^1 for example.

D


  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,388
Default Sumproduct

I forgot to include the double unary version

=SUMPRODUCT(--($A$1:$A$20="This")*--($B$1:$B$20="That"))

"Dave" wrote:

Hi,

Consider the following examples of the same Sumproduct formula all similarly
constructed:-

=SUMPRODUCT(N($A$1:$A$20="This")*N($B$1:$B$20="Tha t"))
=SUMPRODUCT(($A$1:$A$20="This")^1*($B$1:$B$20="Tha t")^1)
=SUMPRODUCT(($A$1:$A$20="This")+0*($B$1:$B$20="Tha t")+0)
=SUMPRODUCT(($A$1:$A$20="This")*1*($B$1:$B$20="Tha t")*1)
=SUMPRODUCT(($A$1:$A$20="This")*($B$1:$B$20="That" ))

All the above work perfectly well and I understand that the first 4 coerce
the True/False evaluation to 1 & 0.
What I don't understand is when would each be selected in preference to the
other and why bother at all when the 5th example works perfectly well.

In my simple (and probably incorrectly advised) world the only time I would
resort to one of the first 4 would be for a formula like:-
=SUMPRODUCT(--($A$1:$A$20="This"))
Because
=SUMPRODUCT(($A$1:$A$20="This"))
would fail but having selected the double unary (as most seem to do) why not
the N switch or ^1 for example.

D


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8,651
Default Sumproduct

The double unary minus version would usually be
=SUMPRODUCT(--($A$1:$A$20="This"),--($B$1:$B$20="That"))
using the comma instead of the multiplication sign, because (as you've
pointed out) the multiplication already does the job of coercing to a
number.
--
David Biddulph

"Dave" wrote in message
...
I forgot to include the double unary version

=SUMPRODUCT(--($A$1:$A$20="This")*--($B$1:$B$20="That"))

"Dave" wrote:

Hi,

Consider the following examples of the same Sumproduct formula all
similarly
constructed:-

=SUMPRODUCT(N($A$1:$A$20="This")*N($B$1:$B$20="Tha t"))
=SUMPRODUCT(($A$1:$A$20="This")^1*($B$1:$B$20="Tha t")^1)
=SUMPRODUCT(($A$1:$A$20="This")+0*($B$1:$B$20="Tha t")+0)
=SUMPRODUCT(($A$1:$A$20="This")*1*($B$1:$B$20="Tha t")*1)
=SUMPRODUCT(($A$1:$A$20="This")*($B$1:$B$20="That" ))

All the above work perfectly well and I understand that the first 4
coerce
the True/False evaluation to 1 & 0.
What I don't understand is when would each be selected in preference to
the
other and why bother at all when the 5th example works perfectly well.

In my simple (and probably incorrectly advised) world the only time I
would
resort to one of the first 4 would be for a formula like:-
=SUMPRODUCT(--($A$1:$A$20="This"))
Because
=SUMPRODUCT(($A$1:$A$20="This"))
would fail but having selected the double unary (as most seem to do) why
not
the N switch or ^1 for example.

D




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
Something better than Sumproduct asg2307 Excel Worksheet Functions 3 December 19th 07 08:19 PM
Sumproduct Across A Row Railrd Excel Discussion (Misc queries) 11 September 27th 07 12:22 PM
sumproduct? sumif(sumproduct)? David Excel Worksheet Functions 3 July 13th 07 07:06 PM
sumproduct? MIchel Khennafi Excel Worksheet Functions 3 November 13th 06 11:37 PM
sumproduct Dewayne Excel Worksheet Functions 3 September 6th 06 05:35 PM


All times are GMT +1. The time now is 07:46 AM.

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

About Us

"It's about Microsoft Excel"