+ Reply to Thread
Results 1 to 4 of 4

Help with the Double unary operator

  1. #1
    Forum Contributor
    Join Date
    12-12-2012
    Location
    Los Angeles
    MS-Off Ver
    Excel 2010
    Posts
    448

    Help with the Double unary operator

    Hello. I was reading about the double unary operator and sumproduct formulas and I don't really understand it. Someone helped me with a formula and he came up with the following. Could someone explain what these formulas are doing? Also, what would happen if I took the unary operator out of the first formula? Lastly, why does the second formula not need a double unary operator? Danks.

    =SUMPRODUCT(--(Data!$A$5:$A$13=Sheet2!$A$3)*(Data!$B$1:$Y$1=Sheet2!B2),Data!$B$5:$Y$13)

    =SUMPRODUCT((Data!$A$5:$A$13=Sheet2!$A$3)*(Data!$B$2:$Y$2=Sheet2!C2)*(Data!$B$1:$Y$1=Sheet2!B2),Data!$B$5:$Y$13)

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Help with the Double unary operator

    When Boolean values are part of any arithmetic expression, True is coerced to 1 and False to 0. The double negation is one such arithmetic operation, but so is the multiplication inside both of your sumproduct functions, so it isn't necessary. You need it in cases when there is no other operation, e.g.,

    =sumproduct(--(a1:a10="Bob"))
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Forum Contributor
    Join Date
    12-12-2012
    Location
    Los Angeles
    MS-Off Ver
    Excel 2010
    Posts
    448

    Re: Help with the Double unary operator

    So, in the formula above the double negation is unnecesarry? What does the formula that you have do? Don't you need two sets of data for a sumproduct?

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Help with the Double unary operator

    Quote Originally Posted by amartino44 View Post
    So, in the formula above the double negation is unnecesarry?
    Yes.

    Quote Originally Posted by amartino44 View Post
    What does the formula that you have do?
    It counts the number of times A1:A10 equals "Bob"

    Quote Originally Posted by amartino44 View Post
    Don't you need two sets of data for a sumproduct?
    No.

    =SUMPRODUCT({1,0,1})

    =SUMPRODUCT(--{TRUE,FALSE,TRUE})
    Last edited by shg; 09-06-2013 at 12:41 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Copy double-clicked cell to next empty row in different sheet with each double-click
    By erhathaway in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 08-25-2013, 12:06 AM
  2. Replies: 1
    Last Post: 08-23-2013, 05:45 PM
  3. Double unary operator
    By Blake 7 in forum Excel General
    Replies: 3
    Last Post: 11-03-2010, 05:43 AM
  4. Unary + Operator
    By xcelion in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 10-09-2005, 06:05 AM
  5. [SOLVED] Unary operators
    By Joe in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 02-14-2005, 03:06 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1