+ Reply to Thread
Results 1 to 3 of 3

Nested If Statement with many conditions

  1. #1
    Registered User
    Join Date
    08-15-2019
    Location
    akron, ohio
    MS-Off Ver
    64 bit
    Posts
    4

    Nested If Statement with many conditions

    I have 14 different cases stemming from one letter in a product code. I tried writing two nested if statements together, but it only seems to work for the first 7 conditions, and when it falls within the first 7 conditions there is a zero added to the end of the cell.
    When ever the letter falls within the second set of conditions the formula does not work. I believe I will have to write a vba but I am not sure how to set up the code.

    I have pasted the formula I used below

    =IF((MID(A5,13,1))="A","N1 WM",IF((MID(A5,13,1))="B","N1 FS",IF((MID(A5,13,1))="C","N12 WM",IF((MID(A5,13,1))="D","N12 FS",IF((MID(A5,13,1))="E","N3R WM",IF((MID(A5,13,1))="F","N3R FS",IF((MID(A5,13,1))="G","N4 WM")))))))&IF((MID(A5,13,1))="H","N4 FS",IF((MID(A5,13,1))="I","N4X WM",IF((MID(A5,13,1))="J","N4X FS",IF((MID(A5,13,1))="K","N3R WM (304 OR 316 STAINLESS)",IF((MID(A5,13,1))="L","N3R FS (304 OR 316 STAINLESS)",IF((MID(A5,13,1))="O","OPEN STYLE, NO ENCL",IF((MID(A5,13,1))="X","SPECIAL")))))))*1

  2. #2
    Forum Expert 63falcondude's Avatar
    Join Date
    08-22-2016
    Location
    USA
    MS-Off Ver
    2016
    Posts
    5,872

    Re: Nested If Statement with many conditions

    Hello and welcome to the forum.

    From what I gathered from your formula, I put together a lookup table and then am able to use a relatively simple formula:

    =VLOOKUP(MID(A5,13,1),D1:E14,2,FALSE)

    See attachment.
    Attached Files Attached Files
    Last edited by 63falcondude; 08-15-2019 at 09:57 AM.

  3. #3
    Forum Expert 63falcondude's Avatar
    Join Date
    08-22-2016
    Location
    USA
    MS-Off Ver
    2016
    Posts
    5,872

    Re: Nested If Statement with many conditions

    An alternative, if you didn't want to use a lookup table and can only have those 14 cases, would be this:

    Please Login or Register  to view this content.

+ 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 statement honoring conditions within a vba loop
    By grubarbarian in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-30-2016, 10:51 AM
  2. Nested IF statement error. Nested True statement is not triggering
    By Lucas7040 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-26-2016, 11:41 AM
  3. Replies: 2
    Last Post: 07-09-2015, 04:25 PM
  4. Nested If Statement with Multiple Logical Conditions
    By gatefire08 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 03-18-2014, 12:17 PM
  5. [SOLVED] 3 conditions coming from one cell.. Nested If Statement??
    By trosasco in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 05-08-2013, 02:52 PM
  6. Replies: 11
    Last Post: 10-26-2011, 03:24 PM
  7. Nested IF statement 3 conditions 3 outcomes
    By Nick_in_Dubai in forum Excel General
    Replies: 1
    Last Post: 03-12-2009, 04:38 AM

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