+ Reply to Thread
Results 1 to 5 of 5

nesting more than 7 if statements

  1. #1
    Forum Contributor
    Join Date
    05-14-2012
    Location
    England
    MS-Off Ver
    Excel 2010/2013
    Posts
    100

    nesting more than 7 if statements

    Hi there, I've come across the problem of nesting more than 7 if statements.
    This if what I've used up to now

    Please Login or Register  to view this content.
    But I need to add more. I've tried using

    Please Login or Register  to view this content.
    which apparently will allow more than 30 but returns a number in the cell not a dd/mm/yy date (even after trying format cell).

    I know there's a way to write a custom formula in VBA but can't work out how to make = If main!C2="Bakery" then let this cell equal the date from the bakery column BUT if Main!C2="Produce" then let this cell value equal the date from the produce column.

    Any help would be appreciated Thank you.

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,464

    Re: nesting more than 7 if statements

    Try using MATCH and CHOOSE.

    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Forum Expert dominicb's Avatar
    Join Date
    01-25-2005
    Location
    Lancashire, England
    MS-Off Ver
    MS Office 2000, 2003, 2007 & 2016 365
    Posts
    4,867

    Re: nesting more than 7 if statements

    Good morning KAPearson

    Your MS Office version is listed as 2003? Is this correct? If so, then Chip Pearson (any relative?) has an article on that very subject here.

    If you have updated to 2007 / 2010 then this limit is no longer there.

    HTH

    DominicB

  4. #4
    Valued Forum Contributor
    Join Date
    04-30-2012
    Location
    Australia
    MS-Off Ver
    Excel 2010
    Posts
    547

    Re: nesting more than 7 if statements

    If you change your nested IFs to this model

    Please Login or Register  to view this content.
    then you can add items as desired. Better, though, would be to use a lookup table. Add a new sheet called "Lookup". Put the items like "Bakery", "BWS" etc in column A. Put the references to the cells in column B, like =Main!BK2, =Main!CO2 etc. Then you can use a Vlookup like

    =vlookup(Main!C2,Lookup!A1:B7,2,false)

    Adjust ranges to suit.
    Like a post? Click the star below it!

  5. #5
    Forum Contributor
    Join Date
    05-14-2012
    Location
    England
    MS-Off Ver
    Excel 2010/2013
    Posts
    100

    Re: nesting more than 7 if statements

    Thanks guys I'll try all those and see which works.

+ 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