+ Reply to Thread
Results 1 to 11 of 11

Nested If Statement with 15 values

Hybrid View

  1. #1
    Registered User
    Join Date
    06-17-2014
    Location
    Baltimore, MD
    MS-Off Ver
    2010
    Posts
    7

    Nested If Statement with 15 values

    Hi All,

    I am trying to create an if statement that has 15 values. If none of those values are true, the cell would have a space (" ") in it. If one is true, it would equal a value of 1-15 and the others would be false. This is the best I could come up with and now I am asking for your help.

    =IF(AR!J4 = "Add",1," ",IF(AR!J4 = "Update/Display",2, " ",IF(AR!J4 = "Add Update/Display",3, " ",IF(AR!J4 = "Update/Display All",4, " ",IF(AR!J4 = "Add Update/Display All",5, " ",IF(AR!J4 = "Update/Display Update/Display All",6, " ",IF(AR!J4 = "Add Update/Display Update/Display All",7, " ",IF(AR!J4 = "Correction",8, " ",IF(AR!J4 = "Add Correction",9, " ",IF(AR!J4 = "Update/Display Correction",10, " ",IF(AR!J4 = "Add Update/Display Correction",11, " ",IF(AR!J4 = "Update/Display All Correction",12, " ",IF(AR!J4 = "Update/Display Update/Display All Correction",14, " ",IF(AR!J4 = "Add Update/Display Update/Display All Correction",15, " "))))))))))))))

    The error I get with this is "Too many Arguments with this Function"

    Thanks for your help

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Nested If Statement with 15 values

    Whoa, whoa whoa there.

    Whenever you find yourself passing a handful of IF statements think again. Almost always there is a better way.

    Have you for instance considered a VLOOKUP, or a LOOKUP of some description or perhaps the common INDEX(MATCH()) combination?

    ... and welcome to the forum by the way...
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Nested If Statement with 15 values

    Make a list of all they key phrases (in the order of the rank 1-15)
    Say in Z1:Z15
    Z1 = Add
    Z2 = Update/Display
    Z3 = Add Update/Display
    etc..

    Then use
    =IFERROR(MATCH(AR!J4,$Z$1:$Z$15,0),"")

  4. #4
    Registered User
    Join Date
    06-17-2014
    Location
    Baltimore, MD
    MS-Off Ver
    2010
    Posts
    7

    Re: Nested If Statement with 15 values

    Thanks for the quick reply. I have not used those functions. I haven't worked with them yet. I will take a look and see what I can come up with.

  5. #5
    Registered User
    Join Date
    06-17-2014
    Location
    Baltimore, MD
    MS-Off Ver
    2010
    Posts
    7

    Re: Nested If Statement with 15 values

    Thanks Jonmo1. When I enter in that formula, I don't get any values in the cells.

    =IFERROR(MATCH(AR!J4,'Display Data'!$A$1:$A$15,0)-1,"")

  6. #6
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.95 for Mac MS 365
    Posts
    8,684

    Re: Nested If Statement with 15 values

    this would be using lookup...
    =LOOKUP(AR!J4,{"ADD","UPDATE/DISPLAY","ADD UPDATE/DISPLAY","UPDATE/DISPLAY ALL","ADD UPDATE/DISPLAY ALL","UPDATE/DISPLAY UPDATE/DISPLAY ALL","ADD UPDATE/DISPLAY UPDATE/DISPLAY ALL","CORRECTION","ADD CORRECTION","UPDATE/DISPLAY CORRECTION","ADD UPDATE/DISPLAY CORRECTION","UPDATE/DISPLAY ALL CORRECTION","UPDATE/DISPLAY UPDATE/DISPLAY ALL CORRECTION","ADD UPDATE/DISPLAY UPDATE/DISPLAY ALL CORRECTION"},{1,2,3,4,5,6,7,8,9,10,11,12,14,15})
    I think I caught all of your conditions.
    still a vlookup might be much easy.
    Make contributors happy, click on the "* Add Reputation" as a way to say thank you.
    Sam Capricci

  7. #7
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Nested If Statement with 15 values

    Which sheet contains the list you created of all the phrases?

    Also, the -1 was a little mistake, it should just be
    =IFERROR(MATCH(AR!J4,'Display Data'!$A$1:$A$15,0),"")

    And your list of phrases must be in A1:A15 on the sheet named Display Data

  8. #8
    Registered User
    Join Date
    06-17-2014
    Location
    Baltimore, MD
    MS-Off Ver
    2010
    Posts
    7

    Re: Nested If Statement with 15 values

    Thanks Jonmo1! That solved my issue. Part of the problem was on the Display Data sheet there were extra spaces after the criteria (I guess my source material that I copied from had spaces), once I changed the formula to removed the -1 and the extra spaces, it came back with the correct values. It really helps to keep things simple.

    Thank you all so much for your help. I would have been beating my head against the wall for hours trying to figure this out.

  9. #9
    Registered User
    Join Date
    06-17-2014
    Location
    Baltimore, MD
    MS-Off Ver
    2010
    Posts
    7

    Re: Nested If Statement with 15 values

    Thanks Sambo Kid. The look up brings back a value of 11, but the value is incorrect. Cell AR!J4 has a value of Update/Display so it should be 2. I am trying to figure out why.

  10. #10
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Nested If Statement with 15 values

    You're welcome.

    FYI, the lookup didn't work because Lookup requires the data in the first array to be sorted in ascending order.

  11. #11
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.95 for Mac MS 365
    Posts
    8,684

    Re: Nested If Statement with 15 values

    I see you marked it solved, but here is a better way than what I gave you earlier using a vlookup for what it's worth.
    Attached Files Attached Files

+ 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] Nested IF Statement Help
    By FM1 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 01-17-2014, 07:00 AM
  2. [SOLVED] Nested If Statement - ISBLANK and ISNA in same statement?
    By Janc in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 04-23-2013, 09:00 AM
  3. Nested if statement
    By Blake 7 in forum Excel General
    Replies: 3
    Last Post: 03-17-2011, 02:48 PM
  4. Nested IF statement
    By quercus23 in forum Excel - New Users/Basics
    Replies: 5
    Last Post: 02-05-2009, 09:28 AM
  5. Replies: 6
    Last Post: 01-14-2009, 06:59 PM

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