# Nested If Statement with many conditions

1. ## 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  Register To Reply

2. ## 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.  Register To Reply

3. ## 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.``  Register To Reply

There are currently 1 users browsing this thread. (0 members and 1 guests) 