+ Reply to Thread
Results 1 to 3 of 3

Nested IFs In Excel Formula

  1. #1
    Registered User
    Join Date
    01-20-2010
    Location
    Toronto
    MS-Off Ver
    Excel 2003
    Posts
    10

    Nested IFs In Excel Formula

    Hey!
    So I have the following:

    Please Login or Register  to view this content.

    That is all in a for loop and thats why "i" is there...

    So the above code works fine but when I try to copy/paste another IF at the end of that like:

    Please Login or Register  to view this content.

    I get this error in visual studio:

    Exception from HRESULT: 0x800A03EC

    I'm assuming the problem is with the formula but it doesn't make any sense because all im doing is copy/pasting which I did for the rest of that formula... Now when I need to add one more it errors?! Dont know...


    For example, this wont work:

    Please Login or Register  to view this content.

    The code in red is what i added, and now doesnt work!
    Thanks,
    Sean

  2. #2
    Valued Forum Contributor jj72uk's Avatar
    Join Date
    03-22-2008
    Location
    Essex, England
    MS-Off Ver
    Work - Office 2000, Home - Office 2007E
    Posts
    360

    Re: Nested IFs In Excel Formula

    Simple answer... excel cannot handle more that 7 nested IF statements. Hence why you add one more and it won't work.

  3. #3
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Nested IFs In Excel Formula

    It's time to replace your IFs with a lookup table. Create a table somewhere in your workbook with the text strings in the first column, the matching numeric columns in the second column.

    Please Login or Register  to view this content.
    Then use a VLOOKUP() or INDEX/MATCH():
    Please Login or Register  to view this content.
    Also, if you're looping through the "i" values inserting that formula one row at a time, that's unnecessary. You can skip the loop and insert the formula in the entire range all at once, or do a FILLDOWN...several ways to eliminate the looping.
    Last edited by JBeaucaire; 02-04-2010 at 05:39 PM.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

+ 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