Q:

Maximum level of nesting reached in IF Statement

I am using the following IF statement in Excel:
=IF(W41="Please Select",0,IF(W41="Plant Hire","XPH",IF(W41="Plant Sales","SPH",IF(W41="Crane Hire","XCH",IF(W41="Crane Sales","SCS",IF(W41="General X-Hire","GXH",IF(W41="Operations","XOP",IF(W41="Goods / Services","GSE",0))))))))

However it won't let me add any more IFs as it is telling me I have reached the maximum allowed. I need to add another six like so:
IF(W41="Plant","XPL",IF(W41="Whale","SWFM",IF(W41="Fire","FTH", etc

Please can someone show me what I would need to do to complete the formula?

A:

This would be easier to do with a lookup table. List all the possible W41 values in column Y and all the corresponding codes in the same row in column Z then use this formula

=IFERROR(VLOOKUP(W41,Y:Z,2,0),0)

