+ Reply to Thread
Results 1 to 6 of 6

Excel wont accept my Nested IF AND FUNCTION

  1. #1
    Registered User
    Join Date
    07-03-2018
    Location
    London
    MS-Off Ver
    1806
    Posts
    2

    Excel wont accept my Nested IF AND FUNCTION

    Hi,
    My excel skills are at a beginner level. I am trying to write a nested if and Function but excel wont accept the formula I have written. Please review it for me as I can not seem to find the error. The code is pasted below:

    =IF(AND(B7="SHORT",E5="SHORT"), "RANGE",
    IF(AND(B7="SHORT",E5="LONG"), "SHORT”,
    IF(AND(B7="LONG",E5="SHORT"), "LONG”,
    IF(AND(B7="SHORT",E5="NEUTRAL"), "SHORT”,
    IF(AND(B7="NEUTRAL",E5="SHORT"), "LONG”,
    IF(AND(B7="NEUTRAL",E5="LONG"), "SHORT”,
    IF(AND(B7="LONG",E5="NEUTRAL"), "LONG”,
    IF(AND(B7="SHORT",E5="NEUTRAL"), "SHORT”,
    ""))))))))
    Thank you in advance.

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,428

    Re: Excel wont accept my Nested IF AND FUNCTION

    Try:

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


    Note the different type of double quote marks on the ends of the lines ... ” is wrong, " is right
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  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
    52,929

    Re: Excel wont accept my Nested IF AND FUNCTION

    You have at least 2 " that are wrong (probably copied from Word?)
    here is another version of your formula...
    =IF(AND(B7="SHORT",E5="SHORT"),"RANGE",
    IF(OR(
    AND(B7="SHORT",E5="LONG"),
    AND(B7="SHORT",E5="NEUTRAL"),
    AND(B7="NEUTRAL",E5="LONG"),
    AND(B7="SHORT",E5="NEUTRAL")),"SHORT",
    IF(OR(
    AND(B7="LONG",E5="SHORT"),
    AND(B7="NEUTRAL",E5="SHORT"),
    AND(B7="LONG",E5="NEUTRAL")),"LONG",
    "")))
    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
    Valued Forum Contributor jtakw's Avatar
    Join Date
    05-05-2018
    Location
    CA, USA
    MS-Off Ver
    2016
    Posts
    668

    Re: Excel wont accept my Nested IF AND FUNCTION

    Quote Originally Posted by FDibbins View Post
    You have at least 2 " that are wrong (probably copied from Word?)
    here is another version of your formula...
    =IF(AND(B7="SHORT",E5="SHORT"),"RANGE",
    IF(OR(
    AND(B7="SHORT",E5="LONG"),
    AND(B7="SHORT",E5="NEUTRAL"),
    AND(B7="NEUTRAL",E5="LONG"),
    AND(B7="SHORT",E5="NEUTRAL")),"SHORT",
    IF(OR(
    AND(B7="LONG",E5="SHORT"),
    AND(B7="NEUTRAL",E5="SHORT"),
    AND(B7="LONG",E5="NEUTRAL")),"LONG",
    "")))
    Hi,

    You can also take out one of the redundant parts in RED from OP's original formula (OP had it "doubled")

  5. #5
    Registered User
    Join Date
    07-03-2018
    Location
    London
    MS-Off Ver
    1806
    Posts
    2

    Re: Excel wont accept my Nested IF AND FUNCTION

    Thank you, Thank you, Thank you. It worked perfectly.

  6. #6
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,428

    Re: Excel wont accept my Nested IF AND FUNCTION

    You're welcome.



    If you are satisfied with the solution(s) provided, please mark your thread as Solved.


    New quick method:
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

    Or you can use this way:

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save


    You may also want to consider thanking those people who helped you by clicking on the little star at the bottom left of their reply to your question.

+ 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. [SOLVED] Text box wont accept numbers
    By scott micklo in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-18-2016, 07:52 AM
  2. Index Match multiple criteria wont work, but nested IF's do-partially
    By andrewoz in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-17-2016, 02:12 AM
  3. Replies: 3
    Last Post: 10-21-2014, 10:35 AM
  4. Excel graph will not accept dynamic function
    By meancookie in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-20-2011, 06:27 AM
  5. File wont accept VBA
    By stin25 in forum Excel General
    Replies: 9
    Last Post: 07-02-2009, 11:36 AM
  6. adv filter wont accept criteria
    By daniel in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 06-03-2006, 04:15 PM
  7. excel 2002 wont accept my code on back of disk
    By racer in forum Excel - New Users/Basics
    Replies: 1
    Last Post: 12-06-2005, 08:00 AM

Tags for this Thread

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