+ Reply to Thread
Results 1 to 13 of 13

Nested IF AND error

  1. #1
    Registered User
    Join Date
    10-25-2016
    Location
    Australia
    MS-Off Ver
    2013
    Posts
    5

    Unhappy Nested IF AND error

    Hi,

    I cannot determine what is wrong with the following formula?

    I have three cells, D12, E12 and F12. I wish to enter one value of a range in D12 (AC, L, P, U, R) and one value of a range in E12 (MI, MO, S, MA, CA) to produce ,depending on the D12 and E12 values entered, a result from a range of values in F12 (L, M, H, C).

    Any assistance would be appreciated!

    =IF(AND(D12="AC", E12="MI", "M", IF(AND(D12="AC", E12="MO", "H", IF(AND(D12="AC", E12="S", "C", IF(AND(D12="AC", E12="MA", "C", IF(AND(D12="AC", E12="CA", "C", IF(AND(D12="L", E12="MI", "M", IF(AND(D12="L", E12="MO", "M", IF(AND(D12="L", E12="S", "M", IF(AND(D12="L", E12="MA", "M", IF(AND(D12="L", E12="CA", "M", IF(AND(D12="P", E12="MI", "M", IF(AND(D12="P", E12="MO", "M", IF(AND(D12="P", E12="S", "M", IF(AND(D12="P", E12="MA", "M", IF(AND(D12="P", E12="CA", "M", IF(AND(D12="U", E12="MI", "M", IF(AND(D12="U", E12="MO", "M", IF(AND(D12="U", E12="S", "M", IF(AND(D12="U", E12="MA", "M", IF(AND(D12="U", E12="CA", "M", IF(AND(D12="R", E12="MI", "M", IF(AND(D12="R", E12="MO", "M", IF(AND(D12="R", E12="S", "M", IF(AND(D12="R", E12="MA", "M", IF(AND(D12="R", E12="CA", "M", " " ))))))))))))))))))))))))))))))))))))))))))))))))))

    Thanks.
    Last edited by John Sheehan; 10-26-2016 at 02:27 AM. Reason: moderator request to change title

  2. #2
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,601

    Re: Why doen't this work?

    Your post does not comply with Rule 1 of our Forum RULES. Your post title should accurately and concisely describe your problem, not your anticipated solution.

    Use terms appropriate to a Google search. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will be addressed according to the OP's experience in the forum: If you have less than 10 posts, expect (and respond to) a request to change your thread title. If you have 10 or more posts, expect your post to be locked, so you can start a new thread with an appropriate title.

    To change a Title go to your first post, click EDIT then Go Advanced and change your title, if 2 days have passed ask a moderator to do it for you.

    (This thread should receive no further responses until this moderation request is fulfilled, as per Forum Rule 7)

  3. #3
    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,169

    Re: Why doen't this work?

    Change title as requested and I'll reply as don't want to the "charged" with malpractice!!

  4. #4
    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: Why doen't this work?

    & John - AND likewise
    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

  5. #5
    Registered User
    Join Date
    10-25-2016
    Location
    Australia
    MS-Off Ver
    2013
    Posts
    5

    Re: Nested IF AND error

    Thank you, I have managed to solve the issue elsewhere.

    The nested IF AND formulas require a parentheses after the conditions.

    Here is the corrected formula for anyone interested:

    =IF(AND(D12="AC", E12="MI"), "M", IF(AND(D12="AC", E12="MO"), "H", IF(AND(D12="AC", E12="S"), "C", IF(AND(D12="AC", E12="MA"), "C", IF(AND(D12="AC", E12="CA"), "C", IF(AND(D12="L", E12="MI"), "M", IF(AND(D12="L", E12="MO"), "M", IF(AND(D12="L", E12="S"), "M", IF(AND(D12="L", E12="MA"), "M", IF(AND(D12="L", E12="CA"), "M", IF(AND(D12="P", E12="MI"), "M", IF(AND(D12="P", E12="MO"), "M", IF(AND(D12="P", E12="S"), "M", IF(AND(D12="P", E12="MA"), "M", IF(AND(D12="P", E12="CA"), "M", IF(AND(D12="U", E12="MI"), "M", IF(AND(D12="U", E12="MO"), "M", IF(AND(D12="U", E12="S"), "M", IF(AND(D12="U", E12="MA"), "M", IF(AND(D12="U", E12="CA"), "M", IF(AND(D12="R", E12="MI"), "M", IF(AND(D12="R", E12="MO"), "M", IF(AND(D12="R", E12="S"), "M", IF(AND(D12="R", E12="MA"), "M", IF(AND(D12="R", E12="CA"), "M", " " )))))))))))))))))))))))))

  6. #6
    Registered User
    Join Date
    10-25-2016
    Location
    Australia
    MS-Off Ver
    2013
    Posts
    5

    Re: Nested IF AND error

    I do apologise to all regarding my poor standard of newbie posting, however, it doesn't take very long for someone to bring that to my attention. I have revised the title as requested.

  7. #7
    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,169

    Re: Nested IF AND error

    Good to see you resolved it yourself: the best form of learning!

  8. #8
    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: Nested IF AND error

    Glad you got it resolved

    I was SO tempted to point out that you had not closed your AND()'s lol

  9. #9
    Registered User
    Join Date
    10-25-2016
    Location
    Australia
    MS-Off Ver
    2013
    Posts
    5

    Re: Nested IF AND error

    Thank you John Topley and FDibbins.... I really do like to solve myself, but time constraints were beating at my door, hence the hastily posted cry for help. Great forum by the way!!!

  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,647

    Re: Nested IF AND error

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.
    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.

  11. #11
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,601

    Re: Nested IF AND error

    Quote Originally Posted by John Sheehan View Post
    Thank you John Topley and FDibbins.... I really do like to solve myself, but time constraints were beating at my door, hence the hastily posted cry for help. Great forum by the way!!!
    We hope you will have more questions.

    However, about your message:
    Thank you, I have managed to solve the issue elsewhere.
    Please note that cross-posting is when you post the same question in other forums on the web. The last thing you want to do is waste people's time working on an issue you have already resolved elsewhere. We prefer that you not cross-post at all, but if you do (and it's unlikely to go unnoticed), you MUST provide a link (copy the url from the address bar in your browser) to the cross-post.

    Expect cross-posted questions without a link to be closed and a message will be posted by the moderator explaining why. We are here to help so help us to help you!

    Read this to understand why we ask you to do this, and then please edit your first post to include links to any and all cross-posts in any other forums (not just this site).

  12. #12
    Registered User
    Join Date
    10-25-2016
    Location
    Australia
    MS-Off Ver
    2013
    Posts
    5

    Re: Nested IF AND error

    Wow, sure wont be breaking any rules here! When I said elsewhere, I referred to my office environment and a little blood swear and tears.

    I do appreciate the heads up though Mr zbor.

  13. #13
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,601

    Re: Nested IF AND error

    Quote Originally Posted by John Sheehan View Post
    When I said elsewhere, I referred to my office environment and a little blood swear and tears.
    No problem John,
    just want to point that

+ 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] formula if cell content doen not equal certain amount of characters
    By Marijke in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-25-2013, 11:19 AM
  2. Header macro doen's save date
    By cosminb in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-11-2011, 07:21 AM
  3. Excel doen't see the output of my macro as a value
    By evertvdhoorn in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-06-2011, 08:50 AM
  4. searchmacro doen't work when initiated from listbox
    By WCJanssen in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-05-2009, 03:27 AM
  5. Range variable doen't adjust to moving cells between sheets
    By gvz2009 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-03-2009, 11:45 AM
  6. Excel Network shraring doen't work
    By santoshramadas in forum Excel General
    Replies: 0
    Last Post: 02-17-2008, 08:22 AM
  7. Replies: 2
    Last Post: 03-09-2006, 10:30 PM
  8. Replies: 0
    Last Post: 01-09-2006, 02:07 PM

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