+ Reply to Thread
Results 1 to 8 of 8

IF both of two conditions exist, I want to post a Y to a cel...

  1. #1
    Registered User
    Join Date
    11-05-2012
    Location
    Northern California
    MS-Off Ver
    Excel 2010
    Posts
    2

    IF both of two conditions exist, I want to post a Y to a cel...

    I tried this and received an error message:

    =IF(AND ((CH>17 OR CG>17) AND (AJ>25 OR AY=+1)), "Y"))

    I want the numerical result in column CH to exceed 17, OR the result in CG to exceed 17; either result satisfies that condition,
    AND
    if either the result in AJ>25 OR AY equals 1, then
    I want Y inserted in a cel.

    But, I cannot figure out what error I made in the above function. Help!

    Stephen aka subrostud

  2. #2
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,728

    Re: IF both of two conditions exist, I want to post a Y to a cel...

    There are several errors - you need to refer to specific cells and not to column identifiers, and you have the syntax wrong for the OR function. Try it like this:

    =IF(AND(OR(CH2>17,CG2>17),OR(AJ2>25,AY2=1)),"Y","")

    I've assumed that this is looking at the cells in row 2, so you would normally put this in another cell in row 2, and then copy it down if required.

    Hope this helps.

    Pete

  3. #3
    Forum Expert dredwolf's Avatar
    Join Date
    10-27-2012
    Location
    Clearwater,Canada
    MS-Off Ver
    Excel 2007
    Posts
    2,649

    Re: IF both of two conditions exist, I want to post a Y to a cel...

    maybe try this :

    =IF(AND(OR(CH>17,CG>17),OR(AJ>25,AY=1)),"Y","")
    A picture may be worth a thousand words, BUT, a sample Workbook is worth a thousand screenshots!
    -Add a File - click advanced (next to quick post), scroll to manage attachments, click, select add files, click select files, select file, click upload, when file shows up at bottom left, click done (bottom right), click submit
    -To mark thread Solved- go top of thread,click Thread Tools,click Mark as Solved
    If you received helpful response, please remember to hit the * of that post

  4. #4
    Forum Expert dredwolf's Avatar
    Join Date
    10-27-2012
    Location
    Clearwater,Canada
    MS-Off Ver
    Excel 2007
    Posts
    2,649

    Re: IF both of two conditions exist, I want to post a Y to a cel...

    oops , sorry Pete

  5. #5
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,728

    Re: IF both of two conditions exist, I want to post a Y to a cel...

    Quote Originally Posted by dredwolf View Post
    oops , sorry Pete
    No problem - it happens all the time to me.

    Pete

  6. #6
    Registered User
    Join Date
    11-05-2012
    Location
    Northern California
    MS-Off Ver
    Excel 2010
    Posts
    2

    Re: IF both of two conditions exist, I want to post a Y to a cel...

    [QUOTE=Pete_UK;2995312]There are several errors - you need to refer to specific cells and not to column identifiers, and you have the syntax wrong for the OR function. Try it like this:

    =IF(AND(OR(CH2>17,CG2>17),OR(AJ2>25,AY2=1)),"Y","")

    I've assumed that this is looking at the cells in row 2, so you would normally put this in another cell in row 2, and then copy it down if required.

    Hope this helps.

    Pete

    Pete:

    Both conditions have to exist to return a "Y" value. I changed the middle "OR" to "AND", and there's still a #VALUE! error.

  7. #7
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,728

    Re: IF both of two conditions exist, I want to post a Y to a cel...

    I'm not sure why you would get a #VALUE error with that formula, as you are not attempting to do arithmetic on text values. Are you sure you typed it in correctly, with all the parentheses and commas?

    Pete

  8. #8
    Forum Expert dredwolf's Avatar
    Join Date
    10-27-2012
    Location
    Clearwater,Canada
    MS-Off Ver
    Excel 2007
    Posts
    2,649

    Re: IF both of two conditions exist, I want to post a Y to a cel...

    subrostud, I think you may be mis-understanding how AND and OR work in Excel, they are not operators, but Functions,
    so a statemen of " IF (this OR this) AND (that OR that)..."
    translates, in EXCEL as "IF(AND(OR(this,this),OR(that,that))..."
    hope that helps

+ 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