0

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.

4
  • You changed IF($S$4="Corn", <something>, <something>) to IF($S$4="Corn", <something>, <something>, <something new>). But IF does not take 4 parameters. Commented Jul 23, 2024 at 16:56
  • 1
    Should be like this you are not following the IF() syntax correctly, instead use IFS() --> =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,"")) Commented Jul 23, 2024 at 16:56
  • 1
    Thanks @MayukhBhattacharya I did not know that was required. That seems to have solved the issue so I can continue working on this. Appreciate the help. Commented Jul 23, 2024 at 17:04
  • Even 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),"")) Commented Jul 23, 2024 at 17:25

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.