+ Reply to Thread
Results 1 to 5 of 5

Nested IF OR not functioning the way I want

  1. #1
    Forum Contributor
    Join Date
    04-14-2013
    Location
    Ky
    MS-Off Ver
    Excel 2013
    Posts
    344

    Nested IF OR not functioning the way I want

    Excel 2007, I have the following formula in cell F21:

    =IF(I17<=8,"INVALID",IF(I17=9," ",IF(OR(I9<=28,I15=1),"ERROR")))

    What I want is for the cell to remain blank if I17 is equal to 9 AND if I15 does not = 1, for the cell to read "Invalid" if I17 is less than 9 (I17 will only be 0-9), OR to read "ERROR" if either I17 is anything between 10 and 28 (28 is the max the cell could be) OR if I15 is equal to 1.

    The formula works fine for returning either a blank, "INVALID" or "ERROR" based on the values or I17 and I9, but does NOT work (does not return "ERROR) based on the value of I15.

    If both I15 = 1 and if I17 <= 8. then "INVALID" should return instead of "ERROR."


    If anyone just wants to be nice, they can look at the uploaded sheet and my formulas and make suggestions on how to make it all cleaner. It is an assessment that uses the answers to 9 questions and assigns a weighted value to one or more of 3 different scales (S1, S2, S3). Scales 1 and 2 are combined for an overall score, while scale 3 is used simply to flag an elevated condition. Some questions are worth just a point, some are worth more or no points for each scale. The formulas for columns E-G through Rows 8-16 are correct. And the scores must be converted to a 6 point scale and the formulas in row 20 for each scale are correct, but, yes answers to Q4 and Q5 are worth 1 point on S1-S3, but for S1 and S3 (not on S2), they are only worth 1 point even if both questions are yes. That's where my formulas in E18 & G18 come in. The end user only completes D8-D16, but each answer must be given. They start with a blank cell but if its left blank, it'll read error. Also, Q1 and Q2 can be yes/yes, no/no, or yes/no, but can not be no/yes - that's where H9 comes in. Also, if D8 has a numeric value other than 0, then either Q4 or Q5 must be yes. See formulas in columns H for those questions.

    I have removed the specific questions because the instrument is proprietary and not yet published, not that anyone on here would care, but it protects me. In the final version, rows 17-19 are hidden, fonts columns H and I are changed to white (to hide them) except for where "ERROR" appears, and the whole sheet is protected except the 9 answer spaces in column D and a couple of identifying cells at the top.
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    11-28-2012
    Location
    Guatemala
    MS-Off Ver
    Excel 2010
    Posts
    2,394

    Re: Nested IF OR not functioning the way I want

    try this code...
    I added the asterisk to asses a 4th posibility if any...*it can be left blank!! ""

    Please Login or Register  to view this content.

  3. #3
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: Nested IF OR not functioning the way I want

    Without knowing what you are trying to achieve, try this...

    =IF(AND(I7=9,I15<>1),"",IF(I17<9,"Invalid",IF(OR(AND(I17>10,I17<28),I15=1),"Error","")))

    The best way to create a formula like this is to build it just like you described it
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  4. #4
    Forum Contributor
    Join Date
    04-14-2013
    Location
    Ky
    MS-Off Ver
    Excel 2013
    Posts
    344

    Re: Nested IF OR not functioning the way I want

    Awesome. Both seemed to work fine. I'm learning... thanks much!!

  5. #5
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: Nested IF OR not functioning the way I want

    Happy to help and thanks for the feedback

+ 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