+ Reply to Thread
Results 1 to 15 of 15

Difficulty with IF, OR, AND formula

  1. #1
    Registered User
    Join Date
    08-07-2017
    Location
    Edinburgh, Scotland
    MS-Off Ver
    2016
    Posts
    10

    Difficulty with IF, OR, AND formula

    Hi!

    Fairly new to Excel and having a bit of difficulty. I'm trying to get the cell to return "TRUE" if AA21 and AC21 are both equal to "1", and also if AA21 and AC21 are both equal to "0". Then I'd like the cell to return "FALSE" if AA21 equals "1" but AC21 equals "0". I've used the following formula and it seems to always return "FALSE" no matter what I do.

    =IF(OR(AND(AA21=,AC21=1),AND(AA21=0,AC21=0)),TRUE,IF(AA21=1,AC21=0,FALSE))

    Anyone able to help?

    Thanks!
    Attached Images Attached Images
    Last edited by RW1992; 08-07-2017 at 06:20 AM.

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,861

    Re: Difficulty with IF, OR, AND formula

    You will need this:

    =IF(OR(AND(AA21=1,AC21=1),AND(AA21=0,AC21=0)),TRUE,IF(AND(AA21=1,AC21=0),FALSE))
    Last edited by AliGW; 08-07-2017 at 05:54 AM.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,468

    Re: Difficulty with IF, OR, AND formula

    You're missing an AND in the second IF.
    Try this:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    It will leave the cell blank if none of the conditions are met.

    BSB

  4. #4
    Registered User
    Join Date
    08-07-2017
    Location
    Edinburgh, Scotland
    MS-Off Ver
    2016
    Posts
    10

    Re: Difficulty with IF, OR, AND formula

    Hi AliGW,

    Thanks for your help!

    I've entered that formula but for some reason it's still only returning FALSE. The cells AA and AC have formulas in them too - will that affect it in any way?

    Cells2.PNG Formula2.PNG

  5. #5
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,861

    Re: Difficulty with IF, OR, AND formula

    It shouldn't do.

    Will you please attach a sample Excel workbook? We are not able to work with or manipulate a picture of one.

    Unfortunately the attachment icon doesn't work at the moment, so to attach an Excel file you have to do the following: just before posting, scroll down to Go Advanced and then scroll down to Manage Attachments. Now follow the instructions at the top of that screen.

  6. #6
    Registered User
    Join Date
    08-07-2017
    Location
    Edinburgh, Scotland
    MS-Off Ver
    2016
    Posts
    10

    Re: Difficulty with IF, OR, AND formula

    Hi BSB,

    Thanks for the help as well. However, this is now returning blank cells all the time. I'm not entirely sure what I've done wrong haha. The cells AA and AC have formulas in them too - but they're working and returning either 1 or 0 accordingly.

    Ryan

  7. #7
    Registered User
    Join Date
    08-07-2017
    Location
    Edinburgh, Scotland
    MS-Off Ver
    2016
    Posts
    10

    Re: Difficulty with IF, OR, AND formula

    Hi Ali,

    Have attached the tab of the worksheet I'm working on.

    Thanks for your help!

    Ryan
    Attached Files Attached Files

  8. #8
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,468

    Re: Difficulty with IF, OR, AND formula

    The values in column AA are stored as text rather than numbers and that is causing the problem.
    Change that or change the formula to this in AA3 and copied down:
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    BSB

  9. #9
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,914

    Re: Difficulty with IF, OR, AND formula

    in AA3 modify your formula as =IFERROR(IF(TODAY()-1=INT(U3),1,0),"TBC")
    instead of =IFERROR(IF(TODAY()-1=INT(U3),"1","0"),"TBC") and copy towards down
    Samba

    Say thanks to those who have helped you by clicking Add Reputation star.

  10. #10
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,861

    Re: Difficulty with IF, OR, AND formula

    What are you expecting to see for this one?

    =IF(OR(AND(M3=1,N3=1),AND(M3=2,P3=1),AND(M3=0,O3=1)),1,0)

    It is correctly returning 1, but you can't see it because of your conditional formatting!

  11. #11
    Registered User
    Join Date
    08-07-2017
    Location
    Edinburgh, Scotland
    MS-Off Ver
    2016
    Posts
    10

    Re: Difficulty with IF, OR, AND formula

    Quote Originally Posted by AliGW View Post
    What are you expecting to see for this one?

    =IF(OR(AND(M3=1,N3=1),AND(M3=2,P3=1),AND(M3=0,O3=1)),1,0)

    It is correctly returning 1, but you can't see it because of your conditional formatting!
    If any of the AND sections are true, then return 1, if none, return 0. Then it's set to change to green if the cell contains a 1 and red if the cell contains a 0

  12. #12
    Registered User
    Join Date
    08-07-2017
    Location
    Edinburgh, Scotland
    MS-Off Ver
    2016
    Posts
    10

    Re: Difficulty with IF, OR, AND formula

    Quote Originally Posted by BadlySpelledBuoy View Post
    The values in column AA are stored as text rather than numbers and that is causing the problem.
    Change that or change the formula to this in AA3 and copied down:
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    BSB
    That worked perfectly. Thanks very much!!

  13. #13
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,206

    Re: Difficulty with IF, OR, AND formula

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

  14. #14
    Registered User
    Join Date
    08-07-2017
    Location
    Edinburgh, Scotland
    MS-Off Ver
    2016
    Posts
    10

    Re: Difficulty with IF, OR, AND formula

    Thanks everyone for your help! Much appreciated!!

  15. #15
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,861

    Re: Difficulty with IF, OR, AND formula

    You're welcome!

+ 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. Difficulty in removing duplicates using formula
    By titihuy in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 12-25-2016, 02:17 AM
  2. [SOLVED] Difficulty using EVALUATE to convert string to formula and return result
    By phbryan in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-27-2016, 10:40 AM
  3. [SOLVED] Why do I have so much difficulty using the FREQUENCY formula consistently correct?
    By slawley1 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-06-2012, 07:07 PM
  4. Replies: 3
    Last Post: 03-08-2012, 09:30 AM
  5. Difficulty With Copying Embedded Formula
    By heliskier89 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-26-2011, 08:38 AM
  6. Difficulty with manual entry/formula in the same cell
    By dolphinstardust in forum Excel General
    Replies: 7
    Last Post: 02-10-2011, 04:19 PM
  7. Price Function - Difficulty in understanding the formula
    By abhi_23 in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 01-18-2006, 05:41 AM

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