+ Reply to Thread
Results 1 to 11 of 11

How deep of Nested IF, AND, OR statements can be utilized

  1. #1
    Registered User
    Join Date
    09-29-2022
    Location
    Canada
    MS-Off Ver
    Latest
    Posts
    13

    Cool How deep of Nested IF, AND, OR statements can be utilized

    Good Day:

    I find I've sort of backed myself into a corner, and like anything after awhile it all starts to look the same.
    Note*** Everything below Line 5 works as it should, this is just for above line 5.
    C15 is also a drop down box

    Background of the file included.
    A2 is a drop down box, you choose 1 of 5 choices.
    B3 is also a drop down box, and you choose 1 of 4 choices
    I am trying to determine how to formulate the IF statement that:
    if in A2 a choice is made, THEN the choice in B3 will determine the price and Place it in D3

    A2 selections have a specific pricing sheet attached to each of the choices
    So, I am aware my current "IF" statement is incomplete.

    Is there a better way to do this?, will I be typing out an IF statement for a week?
    I need to have all 4 B3 statements contained into each of the 5 A2 Choices
    What I have so far, I've separated for ease of reading
    This part works, it's when I try to add additional B2 items that I get whacked

    =IF(ISBLANK(B3),"",IF(AND(A2="Bank 1",B3="LLR-"),"$835.00",
    IF(AND(A2="Bank 2",B3="LLR-"),"$1000.00",
    IF(AND(A2="Bank 3",B3="LLR-"),"$1000.00",
    IF(AND(A2="Bank 4",B3="LLR-"),"$835.00",
    IF(AND(A2="Bank 5",B3="LLR-"),"$850.00",
    IF(AND(A2="Standard Fees",B3="LLR-"),"$1000.00")))))))

    Bonus points if you can split B2 into two Cells, that will accept text.

    I am available by email, or even by phone if this is something you can assist with, and might also post into the Commercial Services forum to pay to get it done right.
    Attached Files Attached Files
    Last edited by WestCoastBoy; 02-22-2023 at 03:05 PM.

  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
    48,502

    Re: How deep of Nested IF, AND, OR statements can be utilized

    Create a matrix (on another sheet) with the A2 values down, say, A2 down, and the B3 values in B1 across. Then complete the matrix. You can now use INDEX/MATCH/MATCH to return the relevant value.

    Please note that putting numbers in quotes and/or manually typing a dollar sign makes the value Text, not a numeric value.
    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
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    30,908

    Re: How deep of Nested IF, AND, OR statements can be utilized

    First

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Your formula returns TEXT and D14?D15 will error

    Consider using a "Lookup" table rather than multiple IFs

    in F3

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Attached Files Attached Files
    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

  4. #4
    Registered User
    Join Date
    09-29-2022
    Location
    Canada
    MS-Off Ver
    Latest
    Posts
    13

    Re: How deep of Nested IF, AND, OR statements can be utilized

    Thanks for a potential solution, While this would probably be great for a single user, the caveat, and I guess I should have mentioned is the following
    This excel piece is part of an invoice, that invoice is a word doc, so this gets filled out by 1 user, then embeds it into the invoice.
    The invoice completed by the 1 user, then gets passed off to an analyst and after the analyst does whatever work they require to do, "if" they need to make changes to the amount charged, they double click the excel portion of the invoice, it pops out of the doc, they make whatever changes they require, and then pop it back in.

    The solution you've provided while great for a single user, I don't think would work if the analyst (could be 1 of a dozen), doesn't have the array to pull the info from correct?
    Trying to keep things as simple as possible, without a lot of other sheet references, so this is why the "IF" statements were proposed...

    Thanks

  5. #5
    Registered User
    Join Date
    09-29-2022
    Location
    Canada
    MS-Off Ver
    Latest
    Posts
    13

    Re: How deep of Nested IF, AND, OR statements can be utilized

    Quote Originally Posted by JohnTopley View Post
    First

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Your formula returns TEXT and D14?D15 will error

    Consider using a "Lookup" table rather than multiple IFs

    in F3

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    The "IF" statements above were all edited to remove identifying info, but from what I've since been told, thats correct, TEXT is being returned, because of the quotes/dollar sign etc.

    Where would the lookup table be located, and would others need to have access to it in order for changes to occur.
    I've added a reply (it didn't quote, but it's there), about how the process works, so would the analyst also need access to that lookup table in order to add/take away

    I'm open to various solutions if need be, so for now, just concerned about being able to match up the bank1 through 5 to the multiple choices. ..there are 4 choices for B3
    I may have to look at not pre-populating the Fee in D3, and enter it manually for now

    Hopefully I've explained things, funny it works in my head LOL, but needed the professionals here to tweak it.

  6. #6
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    30,908

    Re: How deep of Nested IF, AND, OR statements can be utilized

    If you really think mutiple IF statements are better the "lookup" solution then good luck.

    You really expect users to go throght a complex IF statement and make amendements?

    Your description of your process - a recipe for disaster.

    The table can be placed anywhere in workbook.

  7. #7
    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
    48,502

    Re: How deep of Nested IF, AND, OR statements can be utilized

    I'm grateful to John for going to the trouble of producing a sample workbook based on your OP.

    It was what I had in mind, although I would have advocated putting the lookup table on a separate worksheet. That said, you could hide the table but you'd also need to protect it so it can't (easily) be corrupted.

    Now you're going to need to educate me. I have never, as far as I can recall, used an embedded spreadsheet in a word document.

    Now, here's the thing …

    A range does not exist in isolation, it is part of worksheet; a worksheet does not exist in isolation, it is part of a workbook. So, I assume that, rather than a range, it is a workbook that is embedded in your word document. So, in theory, when they double click the excel portion of the invoice, they have access to the embedded workbook. Happy to be corrected, not my field of experience. I'm also guessing that means, if there are multiple copies of the invoice document, there are multiple embedded workbooks.

    Anyway, whether you do this with a lookup table or nested IFs, I suspect that maintenance of this setup is going to be a nightmare.

  8. #8
    Registered User
    Join Date
    09-29-2022
    Location
    Canada
    MS-Off Ver
    Latest
    Posts
    13

    Re: How deep of Nested IF, AND, OR statements can be utilized

    Quote Originally Posted by JohnTopley View Post
    If you really think mutiple IF statements are better the "lookup" solution then good luck.

    You really expect users to go throght a complex IF statement and make amendements?

    Your description of your process - a recipe for disaster.

    The table can be placed anywhere in workbook.
    First of all, I didn't think multiple "IF" statements are better, I didn't know, hence why I posted the question, so thanks for your input, but you didn't have to be a **** about it...but that's fine, only working here with what I have, and what I know, which is why the "maybe someone has a better solution" tag...if the supplied solutions don't or can't work, then that's fine, will figure out something else
    But hey, again thanks for your Input...

  9. #9
    Registered User
    Join Date
    09-29-2022
    Location
    Canada
    MS-Off Ver
    Latest
    Posts
    13

    Re: How deep of Nested IF, AND, OR statements can be utilized

    Quote Originally Posted by TMS View Post
    I'm grateful to John for going to the trouble of producing a sample workbook based on your OP.

    It was what I had in mind, although I would have advocated putting the lookup table on a separate worksheet. That said, you could hide the table but you'd also need to protect it so it can't (easily) be corrupted.

    Now you're going to need to educate me. I have never, as far as I can recall, used an embedded spreadsheet in a word document.

    Now, here's the thing …

    A range does not exist in isolation, it is part of worksheet; a worksheet does not exist in isolation, it is part of a workbook. So, I assume that, rather than a range, it is a workbook that is embedded in your word document. So, in theory, when they double click the excel portion of the invoice, they have access to the embedded workbook. Happy to be corrected, not my field of experience. I'm also guessing that means, if there are multiple copies of the invoice document, there are multiple embedded workbooks.

    Anyway, whether you do this with a lookup table or nested IFs, I suspect that maintenance of this setup is going to be a nightmare.
    Thanks, and you're correct, double clicking they will have access to the embedded workbook. and only 2 copies, but get what you're saying, the set up is already a nightmare, which is why I wondered if there was a better way, once it's set up, then nothing on the back end would change other than once a year, maybe a pricing change, as the scope of the work (b3) never changes. and Banks (A2) rarely change.

    Appreciate the input, I find "most" to be very helpful in these forums, especially with the lesser experienced folk...I'm just trying to fix a broken part of something, and thought it was possibly simpler than what I was thinking

    So saying that, what if an excel invoice or word invoice could be configured to do that, I mean am I looking at the same situation using a pre made configurable Excel Invoice template? or if a Word configured Invoice...Just asking, as it's looking as there's no way around the lookup table/array aspect right now

  10. #10
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    30,908

    Re: How deep of Nested IF, AND, OR statements can be utilized

    Have you considered setting up the invoice in Excel (rather than Word) and creating an Excel_based PDF file as output?

    The "better" solution only relates to replacing the IF with a table but I think it is fair to say we (I !) don't fully understand how this integrates with the Invoice generation.

    Are you able to post a more complete represention i.e Word document + the Excel elements.
    Last edited by JohnTopley; 02-25-2023 at 02:37 AM.

  11. #11
    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
    48,502

    Re: How deep of Nested IF, AND, OR statements can be utilized

    Ok, a few thoughts.

    1. If there are only two copies, the simplest approach might be to maintain a "master" copy controlled (by you?) centrally which is updated and distributed on an as required basis.
    2. There are probably ways of managing the distribution, for example, in the workbook open event handler, checking for the existence of an updated copy in a shared folder, but I think the effort of establishing the update process would not be worthwhile.
    3. Another option would be to use the workbook open event handler to download the lookup table from a central location every time the invoice workbook is opened. Again, for two copies, it might not be worth it … although I think this would be simpler to implement.
    4. I think we could develop a "stand-alone" workbook which could be the base for the embedded workbook and the core of the "master" copy.

+ 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. [SOLVED] Nested IF/THEN Formula - 5 Deep I believe
    By jemmers in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 02-06-2015, 01:46 PM
  2. [SOLVED] Nested if statements containing multiple and statements
    By John M. in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 06-22-2014, 11:48 PM
  3. External Links nested more than one deep
    By Raziaar in forum Excel General
    Replies: 0
    Last Post: 09-06-2013, 06:22 AM
  4. questions with if statements and nested if statements
    By Pat Excel in forum Excel Formulas & Functions
    Replies: 13
    Last Post: 02-03-2013, 01:41 PM
  5. Nested If statements / logic statements
    By Brainless_09 in forum Excel General
    Replies: 3
    Last Post: 06-17-2009, 02:59 PM
  6. Replies: 12
    Last Post: 05-15-2009, 08:38 AM
  7. Can Check Boxes be Utilized in this Way?
    By Eric in forum Excel General
    Replies: 4
    Last Post: 06-22-2006, 04:25 PM

Tags for this Thread

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