Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
tan tan is offline
external usenet poster
 
Posts: 29
Default Understanding the objective '--' used in SUM PRODUCT function

Hi All,

I have did some read up about having '--' in writing up the SUM PRODUCT
function on some websites. But still trying to figure out the reason behind
having '--' in our SUMPRODUCT function. For example,

=SUMPRODUCT(--(PLList=B15),(ShipmKList),--(CountryList=$C$2))

PLList a named range in my database for my product code field. ShipmKList is
named range in my database for my Shipped Amt field. CountryList is named
range for my country field.

I got this function recommended by someone to extract out the total shipped
amt for a particular country and for the product codes i wish to sum. I input
my Product Code in cell B15 and input my country in cell C2 on another sheet.

Second question is how many more criteria can i set based on the SUM PRODUCT
function above and how do i go about adding more criteria.

Thanks in advance!
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,572
Default Understanding the objective '--' used in SUM PRODUCT function

Here is a very extensive explanation of the function:

http://www.xldynamic.com/source/xld.SUMPRODUCT.html

--
HTH,

RD

---------------------------------------------------------------------------
Please keep all correspondence within the NewsGroup, so all may benefit !
---------------------------------------------------------------------------

"Tan" wrote in message
...
Hi All,

I have did some read up about having '--' in writing up the SUM PRODUCT
function on some websites. But still trying to figure out the reason

behind
having '--' in our SUMPRODUCT function. For example,

=SUMPRODUCT(--(PLList=B15),(ShipmKList),--(CountryList=$C$2))

PLList a named range in my database for my product code field. ShipmKList

is
named range in my database for my Shipped Amt field. CountryList is named
range for my country field.

I got this function recommended by someone to extract out the total

shipped
amt for a particular country and for the product codes i wish to sum. I

input
my Product Code in cell B15 and input my country in cell C2 on another

sheet.

Second question is how many more criteria can i set based on the SUM

PRODUCT
function above and how do i go about adding more criteria.

Thanks in advance!


  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
tan tan is offline
external usenet poster
 
Posts: 29
Default Understanding the objective '--' used in SUM PRODUCT function

Hi,

I have read thru this white paper aout SUM PRODUCT and think i have confuse
myself and the article proves too difficult for me to understand why '--' is
needed. Can you help explain the reason behind. By the way, can you help with
my second questions as well. Thanks.

"Ragdyer" wrote:

Here is a very extensive explanation of the function:

http://www.xldynamic.com/source/xld.SUMPRODUCT.html

--
HTH,

RD

---------------------------------------------------------------------------
Please keep all correspondence within the NewsGroup, so all may benefit !
---------------------------------------------------------------------------

"Tan" wrote in message
...
Hi All,

I have did some read up about having '--' in writing up the SUM PRODUCT
function on some websites. But still trying to figure out the reason

behind
having '--' in our SUMPRODUCT function. For example,

=SUMPRODUCT(--(PLList=B15),(ShipmKList),--(CountryList=$C$2))

PLList a named range in my database for my product code field. ShipmKList

is
named range in my database for my Shipped Amt field. CountryList is named
range for my country field.

I got this function recommended by someone to extract out the total

shipped
amt for a particular country and for the product codes i wish to sum. I

input
my Product Code in cell B15 and input my country in cell C2 on another

sheet.

Second question is how many more criteria can i set based on the SUM

PRODUCT
function above and how do i go about adding more criteria.

Thanks in advance!



  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 4,624
Default Understanding the objective '--' used in SUM PRODUCT function

An alternative explanation:

http://www.mcgimpsey.com/excel/doubleneg.html

In article ,
Tan wrote:

I have read thru this white paper aout SUM PRODUCT and think i have confuse
myself and the article proves too difficult for me to understand why '--' is
needed. Can you help explain the reason behind.

  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 4,624
Default Understanding the objective '--' used in SUM PRODUCT function

It's almost always better to post an unrelated question as a separate
thread.

From Help:
Syntax
SUMPRODUCT(array1,array2,array3, ...)
Array1, array2, array3, ... are 2 to 30 arrays
whose components you want to multiply and then add.

So you can have up to 30 arrays. Note that Help is wrong - a single
array can be entered as well.

Add arrays the same way your existing arrays are added. Just make sure
the arrays are the same size.


In article ,
Tan wrote:

By the way, can you help with
my second questions as well.



  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,059
Default Understanding the objective '--' used in SUM PRODUCT function

On Apr 7, 9:40 pm, Tan wrote:
I have read thru this white paper aout SUM PRODUCT and think i have
confuse myself and the article proves too difficult for me to understand
why '--' is needed. Can you help explain the reason behind.


It does not take a "white paper" to explain this. First, in simple
arithmetic, "-" (negation) changes the sign of the operand to the
right. So, if A1 contains -1, -A1 is 1, and --A1 is -1. Second, the
purpose of "--" (double negation) in some SUMPRODUCT() usage is to
convert a non-numeric value to a numeric one. For example, "(A1=B1)"
returns a truth value -- true or false. "--(A1=B1)" causes the truth
value to be treated as a number, namely 1 or 0 respectively.

You wrote earlier:
=SUMPRODUCT(--(PLList=B15),(ShipmKList),--(CountryList=$C$2))
[....]
Second question is how many more criteria can i set based on the SUM
PRODUCT function above and how do i go about adding more criteria


Use Help - Excel Help to see the explanation of SUMPRODUCT. The
function is limited to 30 arguments. However, in some cases, you can
increase the number of conditions by using "clever" arithmetic. For
example, I believe that the following are equivalent (making no value
judgment about them):

=sumproduct(--(PLList=B15), --(CountryList=$C$2))

=sumproduct ((PLList=B15)*(CountryList=$C$2))

Note that no "--" is needed in the second case because "*" causes the
operands to be treated as numeric, resulting in a numeric result, not
a truth value.

  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 15,768
Default Understanding the objective '--' used in SUM PRODUCT function

Note that no "--" is needed in the second case because "*" causes the
operands to be treated as numeric, resulting in a numeric result, not
a truth value


The double unary is never "needed". Someone discovered that it does the same
thing as multiplying the arrays and is slightly more efficient. What does
Help say about the double unary?

It isn't even mentioned!

Biff

"joeu2004" wrote in message
oups.com...
On Apr 7, 9:40 pm, Tan wrote:
I have read thru this white paper aout SUM PRODUCT and think i have
confuse myself and the article proves too difficult for me to understand
why '--' is needed. Can you help explain the reason behind.


It does not take a "white paper" to explain this. First, in simple
arithmetic, "-" (negation) changes the sign of the operand to the
right. So, if A1 contains -1, -A1 is 1, and --A1 is -1. Second, the
purpose of "--" (double negation) in some SUMPRODUCT() usage is to
convert a non-numeric value to a numeric one. For example, "(A1=B1)"
returns a truth value -- true or false. "--(A1=B1)" causes the truth
value to be treated as a number, namely 1 or 0 respectively.

You wrote earlier:
=SUMPRODUCT(--(PLList=B15),(ShipmKList),--(CountryList=$C$2))
[....]
Second question is how many more criteria can i set based on the SUM
PRODUCT function above and how do i go about adding more criteria


Use Help - Excel Help to see the explanation of SUMPRODUCT. The
function is limited to 30 arguments. However, in some cases, you can
increase the number of conditions by using "clever" arithmetic. For
example, I believe that the following are equivalent (making no value
judgment about them):

=sumproduct(--(PLList=B15), --(CountryList=$C$2))

=sumproduct ((PLList=B15)*(CountryList=$C$2))

Note that no "--" is needed in the second case because "*" causes the
operands to be treated as numeric, resulting in a numeric result, not
a truth value.



  #8   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,231
Default Understanding the objective '--' used in SUM PRODUCT function

"T. Valko" wrote...
....
The double unary is never "needed". . . .


Yup. Any idempotent arithmetic operation would do: --TF, TF+0, TF*1,
TF^1. Some arithmetic operation is needed to convert TRUE to numeric 1
and FALSE to numeric 0, and that's ALL the operation should do.

Same could be accomplished with IF(TF,1,0) or N(TF), but those both
eat a nested function call level, and the former only works in
formulas entered as array formulas, and the latter only works with
derived arrays.

What does Help say about the double unary?

It isn't even mentioned!


It shouldn't be. What should be mentioned more prominently is which
functions automatically convert their numeric string or boolean
arguments to numbers automatically and which don't. For example, my
favorite, least orthogonal function in Excel, NPV:

=NPV("100%",{1;2;3}) returns 1.375 rather than 6

and this isn't due to scalar vs array/range semantics,

=SUM("1") returns 1
=SUM({"1";"2";"3"}) returns 0

but

=NPV({"0%","100%"},{1;2;3}) returns {6,1.375} rather than {6,6}

and FTHOI

=NPV({TRUE,FALSE},{1;2;3}) returns {1.375,6} rather than {6,6}

So MSFT *COULD* have chosen to have SUMPRODUCT convert booleans and
numeric strings in entries in its array arguments into numbers, but it
didn't. Therefore, explicit type conversion is necessary, and
idempotent arithmetic operations just happen to be the most efficient
means to do that, and -- just happens to have certain benefits
compared to the alternatives. Pity unary + can't affect the same
result.

  #9   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,572
Default Understanding the objective '--' used in SUM PRODUCT function

I'm on your side with this Biff.
The use (or *over use*) of that unary has been a constant thorn in my side
when it comes to trying to calculate large datalists of numbers, where it
(unary) allows tainted values to be bypassed instead of flagging them (with
#VALUE! errors) so that they might be corrected.

However, I believe your argument, of it not "even" appearing in the Help
files, needs to be re-thought.<g

These XL Help files are such a big joke, that *not* being mentioned might be
considered an endorsement.

Look at Datedif() and the *very extensive* description of Sumproduct()
itself.<vbg
--
Regards,

RD

---------------------------------------------------------------------------
Please keep all correspondence within the NewsGroup, so all may benefit !
---------------------------------------------------------------------------

"T. Valko" wrote in message
...
Note that no "--" is needed in the second case because "*" causes the
operands to be treated as numeric, resulting in a numeric result, not
a truth value


The double unary is never "needed". Someone discovered that it does the

same
thing as multiplying the arrays and is slightly more efficient. What does
Help say about the double unary?

It isn't even mentioned!

Biff

"joeu2004" wrote in message
oups.com...
On Apr 7, 9:40 pm, Tan wrote:
I have read thru this white paper aout SUM PRODUCT and think i have
confuse myself and the article proves too difficult for me to

understand
why '--' is needed. Can you help explain the reason behind.


It does not take a "white paper" to explain this. First, in simple
arithmetic, "-" (negation) changes the sign of the operand to the
right. So, if A1 contains -1, -A1 is 1, and --A1 is -1. Second, the
purpose of "--" (double negation) in some SUMPRODUCT() usage is to
convert a non-numeric value to a numeric one. For example, "(A1=B1)"
returns a truth value -- true or false. "--(A1=B1)" causes the truth
value to be treated as a number, namely 1 or 0 respectively.

You wrote earlier:
=SUMPRODUCT(--(PLList=B15),(ShipmKList),--(CountryList=$C$2))
[....]
Second question is how many more criteria can i set based on the SUM
PRODUCT function above and how do i go about adding more criteria


Use Help - Excel Help to see the explanation of SUMPRODUCT. The
function is limited to 30 arguments. However, in some cases, you can
increase the number of conditions by using "clever" arithmetic. For
example, I believe that the following are equivalent (making no value
judgment about them):

=sumproduct(--(PLList=B15), --(CountryList=$C$2))

=sumproduct ((PLList=B15)*(CountryList=$C$2))

Note that no "--" is needed in the second case because "*" causes the
operands to be treated as numeric, resulting in a numeric result, not
a truth value.




  #10   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 4,624
Default Understanding the objective '--' used in SUM PRODUCT function

The double unary does *not* do the same thing as multiplying the arrays,
and that is what likely leads to the increased efficiency.

When one uses the form

=SUMPRODUCT(arr1 * arr2)

the arrays are converted to numeric arrays, then multiplied, then the
result (a single array) is passed to the SUMPRODUCT function to be
summed.

When one uses the form

=SUMPRODUCT(--arr1,--arr2)

the arrays are converted to numeric arrays, then both arrays are passed
to SUMPRODUCT to be multiplied and summed.

The end result may be the same, but it would not be surprising that a
function optimized to multiply arrays would be somewhat more efficient
than the multiplication operator passed two arrays.

Not sure what you mean about Help - neither the unary minus nor the
multiplication operator are mentioned in Help's SUMPRODUCT topic, but
both are mentioned under Calculation operators.

In article ,
"T. Valko" wrote:

The double unary is never "needed". Someone discovered that it does the same
thing as multiplying the arrays and is slightly more efficient. What does
Help say about the double unary?


It isn't even mentioned!



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
How do I write up a controllers objective click New Users to Excel 1 March 15th 06 08:36 PM
Price Function - Difficulty in understanding the formula abhi_23 Excel Worksheet Functions 0 January 18th 06 09:41 AM
Is there any who can help in understanding the VLOOKUP function Ajay Excel Discussion (Misc queries) 1 October 26th 05 08:19 AM
Understanding Checkbox function Lori Burton Charts and Charting in Excel 1 July 25th 05 01:26 PM
Percent of Objective [email protected] Excel Discussion (Misc queries) 1 March 15th 05 08:12 PM


All times are GMT +1. The time now is 09:29 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"