+ Reply to Thread
Results 1 to 9 of 9

How to manage a large nested if?

  1. #1
    Registered User
    Join Date
    01-22-2011
    Location
    USA
    MS-Off Ver
    Excel 2003
    Posts
    17

    How to manage a large nested if?

    Example.xlsx


    Hello,
    I have a problem which is difficult to me.

    I'm trying to identify a specific Rate.

    Please review the attachement, it might be easier to see the logic in the spreadsheet then for me to type it out.

    I'm trying to identify a way to reduce a large nested if statement down. Maybe use some creative vlookup w/ pivot? I'm stuck and don't know where to begin.

    Thanks!

    Dennis
    Last edited by xdennis; 01-25-2013 at 10:41 PM.

  2. #2
    Banned User!
    Join Date
    10-14-2006
    Posts
    1,211

    Re: How to manage a large nested if?

    Try to set up a lookup table, then use combination of INDEX & MATCH functions.

  3. #3
    Valued Forum Contributor
    Join Date
    09-10-2012
    Location
    Los Angeles, CA
    MS-Off Ver
    Excel 2010
    Posts
    929

    Re: How to manage a large nested if?

    Nice name...

    I used a helper column and used an array-formula... make sure to use an array-enter (CTRL-SHIFT-ENTER) and not just ENTER...

    Here's my attached spreadsheet...

    Hope this helps,
    Dennis
    Attached Files Attached Files

  4. #4
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,929

    Re: How to manage a large nested if?

    @ mama, if you had looked atthe upload, that is pretty much what the OP has?
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  5. #5
    Banned User!
    Join Date
    10-14-2006
    Posts
    1,211

    Re: How to manage a large nested if?

    Quote Originally Posted by FDibbins View Post
    @ mama, if you had looked atthe upload, that is pretty much what the OP has?
    I did see the upload, and the table wasn't setup proper way to use with INDEX & MATCH function

  6. #6
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,929

    Re: How to manage a large nested if?

    @ mama - then maybe advise the OP on how it should look, rather than just a comment like "Try to set up a lookup table, then use combination of INDEX & MATCH functions. "?

  7. #7
    Registered User
    Join Date
    01-22-2011
    Location
    USA
    MS-Off Ver
    Excel 2003
    Posts
    17

    Re: How to manage a large nested if?

    Plan example_2.xlsx

    Hey Dennis, Thanks so much!

    I see you code works perfectly, although I wish I had a better understanding of what it's doing. I never knew of the Array (Ctrl Shift Enter) trick. I had to youtube it for an understanding This trick will come in handy when calculating product pricing for sure!


    Now, I plugged it into a real life example (Attached) and although it appears to be "close" some calculations are still off and I can't figure out why.

    Thanks again for your assistance!

  8. #8
    Valued Forum Contributor
    Join Date
    09-10-2012
    Location
    Los Angeles, CA
    MS-Off Ver
    Excel 2010
    Posts
    929

    Re: How to manage a large nested if?

    Hi xdennis,

    Your helper column should be your range...

    So, row 2 should be 0 and 104
    row 3 should be 104 to 234
    row4 should be 234 to 999999
    row 5 should be 0 to 104
    etc.

    You can use this formula in A2: =IF(C1=C2,B1,0)
    Copy this formula down for your helper column

    Hopefully this will fix your problem...

  9. #9
    Registered User
    Join Date
    01-22-2011
    Location
    USA
    MS-Off Ver
    Excel 2003
    Posts
    17

    Re: [SOLVED] How to manage a large nested if?

    Ah ha! It all makes sense now.

    For some reason I was not "seeing" the range. Now I see the helper column makes the range.

    Thanks again, Dennis!

+ 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