SOLVED

Copper Contributor

I am working on coding a game in excel 2048. I haven't used any macros or VBA's and I have made I combined function for the movement and whether a 2 or 4 can spawn in that cell with an IF AND function. I finished off the function and everything seemed fine until i got the too many arguments alert. Sorry about how long the formula is. But i need an option as its due friday

=IF(AND(\$L\$5=1,\$M\$5=2,F5<2),4,IF(AND(\$L\$5=1,\$M\$5=1,F5<2),2,IF(AND(G10="down",F5=F6,F6<>F7,F7<>F8),0,IF(AND(G10="down",F6=0),0,IF(AND(G10="down",F6<>F5,F6=F7),0,IF(AND(G10="down",F6<>F5,F6<>F7,F7=F8),0,IF(AND(G10="down",F5<>F6,F7=0),0,IF(AND(G10="down",F5<>F6,F7<>F6,F8=0),0,IF(AND(G10="right",F5<>G5,G5<>H5,H5=I5),0,IF(AND(G10="right",F5<>G5,G5=H5),0,IF(AND(G10="right",F5=G5),0,IF(AND(G10="right",F5<>G5,G5<>H5,H5<>I5,I5=0),0,IF(AND(G10="right",F5<>G5,G5<>H5,G5=0),0,IF(AND(G10="left",F5<>G5,G5<>0),F5,IF(AND(G10="left",F5<>G5,G5=0,H5<>F5,H5=0,F5<>I5),F5,IF(AND(G10="left",F5<>G5,G5=0,F5<>H5,H5=0,F5=I5),F5+I5,IF(AND(G10="left",F5<>G5,G5=0,F5=H5),F5+H5,IF(AND(G10="left",F5<>G5,G5=0,F5<>H5,H5=0,F5<>I5),0,IF(AND(G10="left",F5=G5,f5>0),F5+G5,IF(AND(G10="up",F5=F6,f5>0),F5+F6,IF(AND(G10="up",F5<>F6,F6=0,F5=H5),F5+H5,IF(AND(G10="up",F5<>F6,F6=0,F5<>F7,F7=0,F5=F8),F5+F8,F5,IF(AND(g10="left",f5<>g5,f5=0,g5>0,h5<>g5,h5<>0),f5+g5,IF(AND(g10="left",f5<>g5,f5=0,g5>0,h5<>g5,h5=0,g5=i5),g5+I5,IF(and(g10="left",f5=0,g5=0,h5>0,i5<>h5),f5+h5,IF(AND(g10="left",f5=0,g5=0,h5=0,i5>0),f5+i5,IF(and(g10="left",f5=0,g5=h5,g5>0),g5+h5,IF(AND(g10="left",f5=0,g5=0,h5>0,i5=h5),i5+h5,IF(AND(g10="up",f5=0,f6>0,f7<>f6,f7<>0),f5+f6,IF(AND(g10="up",f5=0,f6=0,f7>0,f7<>f8),f5+f8,IF(AND(g10="up",f5=0,f6=0,f7=0,f8<>0),f5+f8,IF(AND(g10="up",f5=0,f6>0,f6=f7),f6+f7,IF(AND(g10="up",f5=0,f6=0,f7=0,f8>0),f5+f8,IF(AND(g10="up",f5=0,f6=f7,f6>0),f6+f7,IF(AND(g10="up",f5=0,f6>0,f7=0,f8=f6),f6+f8,IF(AND(g10="up",f5=0,f6=0,f7=f8),f7+f8,))))))))))))))))))))))))))))))))))))

4 Replies
best response confirmed by cookie02 (Copper Contributor)
Solution

@cookie02 You can use the Value Preview Tooltips to help find the problem. Start with the last IF in your formula. Put your cursor somewhere within that, and then click on the "value_if_false" part of the tooltip. It will highlight that part of the formula.  Work your way back through the formula by selecting each argument in the tooltip, then look at what's highlighted. Then move back to the previous IF statement in your formula and repeat.

Eventually, you will find the one I have highlighted below with the extra argument.

thank you, absolute life saver, i though i just had too many functions or something.

Error is here

it shall be or F5+F8 or F5 (or something else). If keep the former

``````=IF( AND(\$L\$5 = 1, \$M\$5 = 2, F5 < 2), 4,
IF( AND(\$L\$5 = 1, \$M\$5 = 1, F5 < 2), 2,
IF( AND(G10 = "down", F5 = F6, F6 <> F7, F7 <> F8), 0,
IF( AND(G10 = "down", F6 = 0), 0,
IF( AND(G10 = "down", F6 <> F5, F6 = F7), 0,
IF( AND(G10 = "down", F6 <> F5, F6 <> F7, F7 = F8), 0,
IF( AND(G10 = "down", F5 <> F6, F7 = 0), 0,
IF( AND(G10 = "down", F5 <> F6, F7 <> F6, F8 = 0), 0,
IF( AND(G10 = "right", F5 <> G5, G5 <> H5, H5 = I5), 0,
IF( AND(G10 = "right", F5 <> G5, G5 = H5), 0,
IF( AND(G10 = "right", F5 = G5), 0,
IF( AND(G10 = "right",F5 <> G5,G5 <> H5, H5 <> I5, I5 = 0 ), 0,
IF( AND(G10 = "right",F5 <> G5, G5 <> H5,G5 = 0), 0,
IF( AND(G10 = "left",F5 <> G5,G5 <> 0), F5,
IF( AND(G10 = "left",F5 <> G5,G5 = 0,H5 <> F5,H5 = 0,F5 <> I5), F5,
IF( AND(G10 = "left",F5 <> G5,G5 = 0,F5 <> H5,H5 = 0,F5 = I5), F5 + I5,
IF( AND(G10 = "left",F5 <> G5,G5 = 0,F5 = H5), F5 + H5,
IF( AND(G10 = "left",F5 <> G5,G5 = 0,F5 <> H5,H5 = 0,F5 <> I5), 0,
IF( AND(G10 = "left",F5 = G5,F5 > 0),F5 + G5,
IF( AND(G10 = "up", F5 = F6, F5 > 0), F5 + F6,
IF( AND(G10 = "up",F5 <> F6, F6 = 0, F5 = H5), F5 + H5,
IF( AND(G10 = "up", F5 <> F6, F6 = 0, F5 <> F7, F7 = 0, F5 = F8), F5 + F8,
IF( AND(G10="left",F5<>G5,F5=0,G5>0,H5<>G5,H5<>0),F5+G5,
IF(AND(G10="left",F5<>G5,F5=0,G5>0,H5<>G5,H5=0,G5=I5),G5+I5,
IF(AND(G10="left",F5=0,G5=0,H5>0,I5<>H5),F5+H5,
IF(AND(G10="left",F5=0,G5=0,H5=0,I5>0),F5+I5,
IF(AND(G10="left",F5=0,G5=H5,G5>0),G5+H5,
IF(AND(G10="left",F5=0,G5=0,H5>0,I5=H5),I5+H5,
IF(AND(G10="up",F5=0,F6>0,F7<>F6,F7<>0),F5+F6,
IF(AND(G10="up",F5=0,F6=0,F7>0,F7<>F8),F5+F8,
IF(AND(G10="up",F5=0,F6=0,F7=0,F8<>0),F5+F8,
IF(AND(G10="up",F5=0,F6>0,F6=F7),F6+F7,
IF(AND(G10="up",F5=0,F6=0,F7=0,F8>0),F5+F8,
IF(AND(G10="up",F5=0,F6=F7,F6>0),F6+F7,
IF(AND(G10="up",F5=0,F6>0,F7=0,F8=F6),F6+F8,
IF(AND(G10="up",F5=0,F6=0,F7=F8),F7+F8,
))))))))))))))))))))))))))))))))))))``````
1 best response

Accepted Solutions
best response confirmed by cookie02 (Copper Contributor)
Solution

@cookie02 You can use the Value Preview Tooltips to help find the problem. Start with the last IF in your formula. Put your cursor somewhere within that, and then click on the "value_if_false" part of the tooltip. It will highlight that part of the formula.  Work your way back through the formula by selecting each argument in the tooltip, then look at what's highlighted. Then move back to the previous IF statement in your formula and repeat.

Eventually, you will find the one I have highlighted below with the extra argument.