Forum Discussion
Multiple IF Statement with Vlookup not working.
Hi Superbob1980 ,
you are starting the next IF statement before the Vlookup formula is closed. You need to close the Vlookup brackets earlier. Also, you need to use the fourth parameter for Vlookup and set it to "False" for an exact match, unless your data is sorted and you want to return an approximate match.
When using nested formulas, it can be helpful to use Alt+Enter to separate parts of the formula into different rows for better readability.
Here is what I THINK your formula should be corrected to:
=IF(C30="red",VLOOKUP($B$5,$A$38:$G$45,3,false),
IF(C30="amber",VLOOKUP($B$5,$A$38:$G$45,4,false),
IF(C30="green",VLOOKUP($B$5,$A$38:$G$45,5,false),"different color in C30"
)))
The same result can be achieved without IF statements by looking up the value in C30 in a list and returning the position of that result.
=VLOOKUP($B$5,$A$38:$G$45,MATCH(C30,{"red","amber","green"},0)+2,FALSE)
If C30 is red, then the MATCH function will return 1. Add 2 and arrive at the number 3, which is the column you want in the Vlookup.
IngeborgHawighorst Thank you so much that worked perfectly.