+ 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)

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