+ Reply to Thread
Results 1 to 8 of 8

Work around for nested IF limit

  1. #1
    Registered User
    Join Date
    04-15-2013
    Location
    Hartford, CT
    MS-Off Ver
    Excel 2003
    Posts
    3

    Work around for nested IF limit

    I am looking for an alternative formula to get around the 7 nested IF limit. This is the formula that I am using: "=IF(ISNUMBER(SEARCH("WARE",F10)),G10-(30/60/24),IF(ISNUMBER(SEARCH("PALMER",F10)),G10-(30/60/24),IF(ISNUMBER(SEARCH("AMHERST",F10)),G10-(45/60/24),IF(ISNUMBER(SEARCH("BELCHERTOWN",F10)),G10-(30/60/24),IF(ISNUMBER(SEARCH("CHICOPEE",F10)),G10-(45/60/24),IF(ISNUMBER(SEARCH("EAST LONGMEADOW",F10)),G10-(60/60/24)))))))." As you can see it is looking for town names in a cell and performing a time calc based on the town. My issue is that I need to extend this formula to about 25 more towns. Any help would be greatly appreciated.

  2. #2
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Work around for nested IF limit

    One way is using & and not comma between if. This has a limit of 30!

    "=IF(ISNUMBER(SEARCH("WARE",F10)),G10-(30/60/24)&IF(ISNUMBER(SEARCH("PALMER",F10)),G10-(30/60/24)&if....
    Regards

    Fotis.

    -This is my Greek whisper to Europe.

    --Remember, saying thanks only takes a second or two. Click the little star * below, to give some Rep if you think an answer deserves it.

    Advanced Excel Techniques: http://excelxor.com/

    --KISS(Keep it simple Stupid)

    --Bring them back.

    ---See about Acropolis of Athens.

    --Visit Greece.

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

    Re: Work around for nested IF limit

    It appears that the 30 45 60 is the only part that changes in the basic calculation
    G10-(45/60/24)

    You can creaate a lookup table of all the towns and their corresponding number (30 or 45 or 60)

    So for the given example
    Say

    M1:N6
    M1:M6 = the town names
    N1:N6 = the corresponding number for that town. 30 45 or 60

    Then use

    =G10-(LOOKUP(2^15,SEARCH($M$1:$M$6,F10),$N$1:$N$6)/60/24)
    Last edited by Jonmo1; 04-16-2013 at 10:07 AM.

  4. #4
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Work around for nested IF limit

    Create a 2 column table with the town names in the left column and the already calculated value in the right column.

    Then you can use some form of a lookup formula.

    You're using the SEARCH function in your current formula. Does that mean cell F10 may contain additional text including the town name?
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  5. #5
    Registered User
    Join Date
    04-15-2013
    Location
    Hartford, CT
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: Work around for nested IF limit

    Biff, yes the cell F10 contains an entire address and I am pulling out only the town.

  6. #6
    Registered User
    Join Date
    04-15-2013
    Location
    Hartford, CT
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: Work around for nested IF limit

    Replacing the comma with "&" returns a value of "FALSE" as opposed to the time value that is returned with the comma. Am I missing something?

  7. #7
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Work around for nested IF limit

    http://spreadsheetpage.com/index.php..._if_functions/

    But be sure that if you upload a sample workbook you'll find your solution too soon...

  8. #8
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Work around for nested IF limit

    Try this...

    Create this table in the range A2:B7.

    WARE.........................0:30
    PALMER......................0:30
    AMHERST....................0:45
    BELCHERTOWN.............0:30
    CHICOPEE...................0:45
    EAST LONGMEADOW.....1:00

    Then, the formula would be:

    =G10-LOOKUP(1E100,SEARCH(A2:A7,F10),B2:B7)

+ 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