+ Reply to Thread
Results 1 to 15 of 15

More than 64 nested IF functions

Hybrid View

  1. #1
    Registered User
    Join Date
    09-21-2012
    Location
    Roma
    MS-Off Ver
    Excel 2010
    Posts
    68

    More than 64 nested IF functions

    Good morning everyone.

    I am struggling with a problem that I am not able to solve.

    I have an excel sheet in 2010 in which I should make some choices conditioned, nesting the functions "IF".
    The problem is that Excel 2010 does not allow more than 64 nesting of "IF", while the possible choices are 127.

    In practice, if I have a certain value in cell A2, must appear another certain value in cell B2. And so to the end (at the time the lines are over 132,000).

    To give an example of formula (which of course is to be inserted into cell B2):

    = IF (A1 = "Rome"; "Italy"; IF (A1 = "London", "England"; IF (A1 = "Beijing", "China"; "Not Defined")))

    Going into detail of my spreadsheet, in a column there are some codes, each of which corresponds to the name of a specific location. At the time, filtering the data, I select the empty cells and I manually insert the name of the location in relation to the code present in the column. But I would like to automate the process.

    As I said, the problem is that the choices are well 127, while Excel 2010 allows a maximum of 64 nesting "IF".
    Wandering on the web, I read of the possibility to use the "CHOOSE", but I did not understand how to proceed.

    Could you help me? If it is necessary I could post an example.

    Thanks in advance.

  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: More than 64 nested IF functions

    Hi

    Looks that an INDEX & MATCH should do the trick.

    Of course a sample worksheet will help us to help you.

    To attach a small sample workbook.

    Click on GO ADVANCED and use the paperclip icon to open the upload window.

    View Pic
    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
    Registered User
    Join Date
    09-21-2012
    Location
    Roma
    MS-Off Ver
    Excel 2010
    Posts
    68

    Re: More than 64 nested IF functions

    Quote Originally Posted by Fotis1991 View Post
    Hi

    Looks that an INDEX & MATCH should do the trick.

    Of course a sample worksheet will help us to help you.

    To attach a small sample workbook.

    Click on GO ADVANCED and use the paperclip icon to open the upload window.

    View Pic
    Thank you.

    I will try to attach a small file.

    Best regards

  4. #4
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,239

    Re: More than 64 nested IF functions

    Can't you just use VLookup with a mapping table?

  5. #5
    Registered User
    Join Date
    09-21-2012
    Location
    Roma
    MS-Off Ver
    Excel 2010
    Posts
    68

    Re: More than 64 nested IF functions

    Quote Originally Posted by Kyle123 View Post
    Can't you just use VLookup with a mapping table?
    Thanks for your reply.

    Unfortunately, I don't speak english well. And I'm not a good developer. I'm sorry.

    When you say VLookup, you will say VBA Editor?

    Best regards

  6. #6
    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: More than 64 nested IF functions

    INDEX & MATCH of my suggestion and VLOOKUP that Kyle123 suggested will do (almost) the same job.

  7. #7
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    16,037

    Re: More than 64 nested IF functions

    Look here.

    Add more Towns/countries in I and J column.
    Attached Files Attached Files
    Never use Merged Cells in Excel

  8. #8
    Registered User
    Join Date
    09-21-2012
    Location
    Roma
    MS-Off Ver
    Excel 2010
    Posts
    68

    Re: More than 64 nested IF functions

    Quote Originally Posted by zbor View Post
    Look here.

    Add more Towns/countries in I and J column.
    Thanks for your response.

    I think I understand the process. I'll try and let you know

    Best regards

  9. #9
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,239

    Re: More than 64 nested IF functions

    @zbor, that's thoughtful touch for users without IFERROR

  10. #10
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    16,037

    Re: More than 64 nested IF functions

    You are right. Old habit. I should go with IFERROR

    Formula: copy to clipboard
    =IFERROR(VLOOKUP(A2;$I$1:$J$1000;2;FALSE);"Not Defined")

  11. #11
    Registered User
    Join Date
    09-21-2012
    Location
    Roma
    MS-Off Ver
    Excel 2010
    Posts
    68

    Re: More than 64 nested IF functions

    Good morning everyone.

    I solved the problem building the following macro:

    Function myIF(a as variant)
    Select Case a
    case "condition1"
    myIF = "result1"
    !
    !
    !
    case "condition127"
    myIF = "result127"
    End Select
    End Function


    The only problem is that save operations of the spreadsheet are a bit slow after macro performing, but I think that this is a feature of Excel.
    Thanks to all.

  12. #12
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,239

    Re: More than 64 nested IF functions

    Much, much easier to have a lookup table as zbor posted...

  13. #13
    Registered User
    Join Date
    09-21-2012
    Location
    Roma
    MS-Off Ver
    Excel 2010
    Posts
    68

    Re: More than 64 nested IF functions

    Quote Originally Posted by Kyle123 View Post
    Much, much easier to have a lookup table as zbor posted...
    Hello.

    Thanks for the reply. Unfortunately I do not know how to build a lookup table, and the macro seems to work well.

  14. #14
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,239

    Re: More than 64 nested IF functions

    Did you download zbors workbook?

  15. #15
    Registered User
    Join Date
    09-21-2012
    Location
    Roma
    MS-Off Ver
    Excel 2010
    Posts
    68

    Re: More than 64 nested IF functions

    Quote Originally Posted by Kyle123 View Post
    Did you download zbors workbook?
    Yes, I did it, but it was easier for me to build the macro that I posted.

+ 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. Nested if functions help
    By ashley22 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 06-16-2014, 04:46 PM
  2. nested functions
    By mortitia_uk in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 06-05-2009, 08:39 AM
  3. Nested functions HELP!
    By chiefnmd in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 03:05 PM
  4. [SOLVED] Nested functions HELP!
    By chiefnmd in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 03:05 AM
  5. Nested IF and MID functions
    By Jan Buckley in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-05-2005, 11:05 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