+ Reply to Thread
Results 1 to 3 of 3

The OR() function does not work nicely :(

  1. #1
    Registered User
    Join Date
    11-02-2012
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    81

    The OR() function does not work nicely :(

    Hi, everyone,

    You know that =OR(1,0) will return 1, and =SUM(OR(1,0),OR(1,0)) will return 2. But the formula =SUM(OR(A1:A2,B1:B2)) with array applied will return 1, although cells A1,A2,B1,B2 are all 1. What I have hoped is that the value is 2, given the definition of the OR() function.

    Is there another way to do this? Whenever there is 1, it will be 1. Only if both are 0, then it is 0.

    Thanks for help.

  2. #2
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: The OR() function does not work nicely :(

    that is not how you use =OR() the syntax is = OR(a1=1,b1=0) which gives true if either condition is met
    other examples would be
    OR(a1=1,b1=0,c1=5) OR(a1={1,2,3,4}) or(a1={"cat","dog","mouse"})
    what exactly are you trying to do?
    for just those cells
    =2-SUMPRODUCT((A1:A2=0)*(B1:B2=0))
    Last edited by martindwilson; 03-13-2013 at 08:31 AM.
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  3. #3
    Registered User
    Join Date
    11-02-2012
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    81

    Re: The OR() function does not work nicely :(

    Hi Martin, your formula worked. Thanks

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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