+ Reply to Thread
Results 1 to 18 of 18

A simple logical expression that I can't figure out

  1. #1
    Forum Contributor
    Join Date
    06-29-2016
    Location
    Bristol, England
    MS-Off Ver
    2007
    Posts
    355

    A simple logical expression that I can't figure out

    Hi. This seems so simple, but I can't find the answer (I'm getting old!)

    I have 3 columns A,B,C. Columns A & B contain values which are either zero or non-zero.

    In C I want a logical expression which returns TRUE if A & B are both zero, or if they are both none-zero, but FALSE if one is zero and the other is non-zero.

    Values of 1 or 0 rather than TRUE or FALSE would be ok if it makes the formula simpler.

    It needs to be as simple as possible please, as it will form part of a longer expression later.

    Many thanks

    K

  2. #2
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: A simple logical expression that I can't figure out

    Are empty cells possible? An empty cell evaluates as 0.

    Might there be negative numbers?
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  3. #3
    Forum Contributor
    Join Date
    06-29-2016
    Location
    Bristol, England
    MS-Off Ver
    2007
    Posts
    355

    Re: A simple logical expression that I can't figure out

    Hi, negative numbers yes, empty cells no.

    Thx

  4. #4
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: A simple logical expression that I can't figure out

    try
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    1 1 TRUE
    0 0 TRUE
    1 0 FALSE
    0 1 FALSE
    -1 -1 TRUE etc...

  5. #5
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: A simple logical expression that I can't figure out

    Quote Originally Posted by Trebor777 View Post
    Hi, negative numbers yes, empty cells no.
    One way...

    =OR(COUNTIF(A1:B1,0)=2,COUNTIF(A1:B1,0)=0)

  6. #6
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: A simple logical expression that I can't figure out

    This one is a few keystrokes shorter...

    =MOD(COUNTIF(A1:B1,0),2)=0

  7. #7
    Forum Contributor
    Join Date
    06-29-2016
    Location
    Bristol, England
    MS-Off Ver
    2007
    Posts
    355

    Re: A simple logical expression that I can't figure out

    Quote Originally Posted by sandy666 View Post
    try
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    1 1 TRUE
    0 0 TRUE
    1 0 FALSE
    0 1 FALSE
    -1 -1 TRUE etc...
    Hi I'm getting #NAME? Very sorry I ought have mentioned I have excel 2007

  8. #8
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: A simple logical expression that I can't figure out

    Quote Originally Posted by Trebor777 View Post
    Hi I'm getting #NAME?
    The XOR function is not available in Excel 2007.

    Very sorry I ought have mentioned I have excel 2007
    It's noted in your profile. It's all good!

    At least you didn't tell us you're using:

    MS-Off Ver PeeSee(64)=ROUND(4.831^4.831,0)
    Last edited by Tony Valko; 01-15-2017 at 11:04 AM.

  9. #9
    Forum Contributor
    Join Date
    06-29-2016
    Location
    Bristol, England
    MS-Off Ver
    2007
    Posts
    355

    Re: A simple logical expression that I can't figure out

    Also I ought have mentioned my non-zero values are not necessarily numbers, some are text, sorry if this has caused confusion. K

  10. #10
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: A simple logical expression that I can't figure out

    Quote Originally Posted by Trebor777 View Post
    Also I ought have mentioned my non-zero values are not necessarily numbers, some are text
    Are these the results from formulas?

  11. #11
    Forum Contributor
    Join Date
    06-29-2016
    Location
    Bristol, England
    MS-Off Ver
    2007
    Posts
    355

    Re: A simple logical expression that I can't figure out

    Quote Originally Posted by Tony Valko View Post
    This one is a few keystrokes shorter...

    =MOD(COUNTIF(A1:B1,0),2)=0
    This is working thanks. I wonder if I ought upgrade though, the xor is so elegant

  12. #12
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: A simple logical expression that I can't figure out

    @Trebor777
    Sorry about that with Ex2007 and XOR() function

    @Tony
    Make footnote from this: MS-Off Ver PeeSee(64)=ROUND(4.831^4.831,0) . Will be funnier

  13. #13
    Forum Contributor
    Join Date
    06-29-2016
    Location
    Bristol, England
    MS-Off Ver
    2007
    Posts
    355

    Re: A simple logical expression that I can't figure out

    No problem sandy, I have wondered many times about upgraging

  14. #14
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: A simple logical expression that I can't figure out

    Quote Originally Posted by Trebor777 View Post
    This is working thanks.
    You're welcome!

    I wonder if I ought upgrade though, the xor is so elegant
    There's a few new functions in Excel 2016. I might consider an "upgrade" as long as someone else is paying for it!

    On a side note...

    I still use Excel 2002 as my default version!

  15. #15
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: A simple logical expression that I can't figure out

    btw. here is XOR() for Ex2007 for the case above
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    but it doesn't accept the text values.

  16. #16
    Forum Contributor
    Join Date
    06-29-2016
    Location
    Bristol, England
    MS-Off Ver
    2007
    Posts
    355

    Re: A simple logical expression that I can't figure out

    Quote Originally Posted by sandy666 View Post
    btw. here is XOR() for Ex2007 for the case above
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    but it doesn't accept the text values.
    I really need xor

  17. #17
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: A simple logical expression that I can't figure out

    I wish you all the best
    Maybe you can try:
    XOR function
    Applies To: Excel 2016 Excel 2013 Excel 2016 for Mac Excel for Mac 2011 Excel Online Excel for iPad

  18. #18
    Registered User
    Join Date
    03-09-2013
    Location
    North Carolina, USA
    MS-Off Ver
    Excel 2003
    Posts
    1

    Re: A simple logical expression that I can't figure out

    This seems to work:

    =(OR(N25+O25=0,AND(N25>0,O25>0)))

    just replace with your cells. Good Luck!

+ 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. Nested Vlookups with logical (OR) expression
    By AndyinAus in forum Excel General
    Replies: 7
    Last Post: 11-28-2016, 08:26 PM
  2. Avoid repeating inner equation in a logical expression
    By michellepace in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 07-19-2016, 11:19 AM
  3. [SOLVED] Logical Expression Question
    By wz4np1 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-13-2012, 10:00 AM
  4. Replies: 1
    Last Post: 06-05-2008, 12:55 AM
  5. [SOLVED] Can I use more complex logical expression for sumif as creteria?
    By xwenx in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 04-27-2006, 08:00 PM
  6. [SOLVED] Logical Expression For MULTIPLE Cells???
    By triple_c77@yahoo.com in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-22-2005, 07:10 PM
  7. Replies: 2
    Last Post: 12-05-2005, 06:15 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