+ Reply to Thread
Results 1 to 6 of 6

if statement problem ? length

  1. #1
    Forum Contributor
    Join Date
    05-08-2005
    Location
    Australia
    MS-Off Ver
    excel 2019
    Posts
    112

    if statement problem ? length

    I am using a long if statement like the one below, whenever I add another cell such as j9 I get an error, what am I doing wrong or is there a limit to the if statement. I am using excel 97. thanks

    =IF(J1="andrew","a",IF(J2="andrew","b",IF(J3="andrew","c",IF(J4="andrew","d",IF(J5="andrew","e",IF(J6="andrew","f",IF(J7="andrew'","g",IF(J8="andrew","h"))))))))


    andrewm

  2. #2
    Registered User
    Join Date
    05-19-2005
    Posts
    2

    too many nested ifs

    any solution to your problem? I have just encountered the same problem.

  3. #3
    Forum Expert
    Join Date
    06-18-2004
    Location
    Canada
    MS-Off Ver
    Office 2016
    Posts
    1,474
    Yes, there's a limit and you've reached it. Try the following instead...

    =INDEX({"a","b","c","d","e","f","g","h"},MATCH("andrew",J1:J8,0))

    OR

    =INDEX(A1:A8,MATCH("andrew",J1:J8,0))

    ...where A1:A8 contains your values, such as "a", "b", "c", etc.

    Hope this helps!

  4. #4
    Forum Contributor
    Join Date
    05-08-2005
    Location
    Australia
    MS-Off Ver
    excel 2019
    Posts
    112
    I think it is go to do with excel 97, has this issue been rectified by newer versions or am i wrong

    andrewm

  5. #5
    Forum Expert
    Join Date
    06-18-2004
    Location
    Canada
    MS-Off Ver
    Office 2016
    Posts
    1,474
    I believe that you can only nest up to 7 IF statements. Although, with my Mac version of Excel, I'm able to nest up to 8. Did you find my solution helpful?

  6. #6
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP, 2007, 2024
    Posts
    16,378
    Quote Originally Posted by andrewm
    I think it is go to do with excel 97, has this issue been rectified by newer versions or am i wrong

    andrewm
    Excel 2002 claims only 7 nested IF functions. I haven't heard that 2003 allows for more nesting.
    It looks like your best approach is going to be a lookup table/array like domenic is proposing.

+ 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