"Too Many Arguments" error in IF function
I was trying to formulate an automated indicator for the lot size of commodities, so I drafted this IF
function but it gives an error saying "too many arguments". How can I overcome this hindrance?
=IF(E2="GOLD",100,IF(E2="GOLDM",10,IF(E2="SILVER",30,IF(E2="SILVERM",5,IF("CRUDEOIL",100,IF(E2="COPPER",1000,IF="COPPERM",250,IF(E2="NATURALGAS",1250,0)))))))
Solution 1:
You are missing (E2
in the COPPERM
part (which then requires an extra closing )
). That's what's causing the error.
The CRUDEOIL
part is also missing the check against E2
, which I have fixed:
=IF(E2="GOLD",100,IF(E2="GOLDM",10,IF(E2="SILVER",30,IF(E2="SILVERM",5,IF(E2="CRUDEOIL",100,IF(E2="COPPER",1000,IF(E2="COPPERM",250,IF(E2="NATURALGAS",1250,0))))))))
As recommended by a few users, here's a simple example of how to use VLOOKUP()
to do the same thing as your formula: