I am having a problem where I am unable to find out the issue with my formula in Excel. Everything worked fine until I added an additional argument to the string, but I do not see any erroneous commas or missing parentheses to warrant the error.
Current formula: =IF(B30=0," ",IF($S$4="Corn",(VLOOKUP($M$4,CornExpected,MATCH(A30,'Corn Data'!$D$4:$Q$4,0),0)),VLOOKUP($M$4,SoyExpected,MATCH(A30,'Soybean Data'!$B$4:$O$4,0),0),VLOOKUP($M$4,WheatExpected,MATCH(A30,'Wheat Data'!$B$4:$O$4,0),0))))
Prior (working) formula: =IF(B30=0," ",IF($S$4="Corn",(VLOOKUP($M$4,CornExpected,MATCH(A30,'Corn Data'!$D$4:$Q$4,0),0)),VLOOKUP($M$4,SoyExpected,MATCH(A30,'Soybean Data'!$B$4:$O$4,0),0))
Have tried adding more/fewer parentheses to end of string. Have looked for erroneous commas.
IF($S$4="Corn", <something>, <something>)toIF($S$4="Corn", <something>, <something>, <something new>). ButIFdoes not take 4 parameters.IF()syntax correctly, instead useIFS()-->=IF(B30=0," ", IFS($S$4="Corn", VLOOKUP($M$4,CornExpected,MATCH(A30,'Corn Data'!$D$4:$Q$4,0),0), $S$4="Soybean", VLOOKUP($M$4,SoyExpected,MATCH(A30,'Soybean Data'!$B$4:$O$4,0),0), $S$4="Wheat", VLOOKUP($M$4,WheatExpected,MATCH(A30,'Wheat Data'!$B$4:$O$4,0),0),TRUE,""))SWITCH()should work :=IF(B30=0," ", SWITCH($S$4,"Corn", VLOOKUP($M$4,CornExpected,MATCH(A30,'Corn Data'!$D$4:$Q$4,0),0), "Soybean", VLOOKUP($M$4,SoyExpected,MATCH(A30,'Soybean Data'!$B$4:$O$4,0),0), "Wheat", VLOOKUP($M$4,WheatExpected,MATCH(A30,'Wheat Data'!$B$4:$O$4,0),0),""))