+ Reply to Thread
Results 1 to 4 of 4

Run Out Room On If Statements

Hybrid View

  1. #1
    Valued Forum Contributor
    Join Date
    11-15-2007
    Location
    England
    MS-Off Ver
    Office Pro Plus 2021
    Posts
    424

    Run Out Room On If Statements

    Hi,

    I can't add any more If statements to the following

    =IF(Z7=10,MID(W7,2,8),IF(LEFT(W7,3)="978",MID(W7,5,8),IF(LEFT(W7,4)="7153",MID(W7,1,8),IF(LEFT(W7,3)="486",MID(W7,1,8),IF(LEFT(W7,3)="276",MID(W7,1,8),IF(LEFT(W7,3)="891",MID(W7,1,8),IF(LEFT(W7,3)="873",MID(W7,1,8))))))))

    I have half a dozen more to do can someone advise how to get around this please?

    Many thanks.

  2. #2
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    25,414

    Re: Run Out Room On If Statements

    Try this:

    =IF(Z7=10,MID(W7,2,8),IF(LEFT(W7,3)="978",MID(W7,5,8),IF(or(LEFT(W7,4)="7153",LEFT(W7,3) ="486",LEFT(W7,3)="276",LEFT(W7,3)="891",LEFT(W7,3)="87 3"),MID(W7,1,8),""))) & IF ...

    You can add more conditions beyond this.

    Hope this helps.

    Pete

  3. #3
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: Run Out Room On If Statements

    Excel 2003 has a limit of 7 nested IF()'s so you're going to have to go with a lookup table.

  4. #4
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    25,414

    Re: Run Out Room On If Statements

    Quote Originally Posted by Cutter View Post
    Excel 2003 has a limit of 7 nested IF()'s ...
    You can get around it like this:

    =IF( , ,"") & IF( , ,"") & IF( , ,"") & IF( , ,"") & IF( , ,"") & IF( , ,"") & IF( , ,"") & IF( , ,"") & IF( , ,"")

    and so on.

    I simplified the original expression as five of the conditions were all using MID(W7,1,8) and so could be put in one IF with an OR.

    Pete

+ 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