# Excel Formula syntax error

This topic is 4972 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I have this formula:- =IF(B4=8,IF(C4=4,"OK",IF(B4=8,IF(C4=0,"OK",$A$4),IF(B4=0,IF(C4=8,"OK",$A$4),$A$4)))),IF(B4=4,IF(C4=8,"OK",IF(B4=8,IF(C4=0,"OK",$A$4),IF(B4=0,IF(C4=8,"OK",$A$4),$A$4)))$A$4),$A$4) Can anybody please identify the syntax error(s)? I am stumped. Thank you.

##### Share on other sites
On the off chance this isn't a joke, I'll take a stab at it. Been a while since I did anything even remotely complex with Excel, but a cursury glance reveals a missing comma [second to last $A$4]. Also, your initial IF statement only has a then, but no else. This is followed by two additional comma separated statements with a trailing parenthesis. I believe all three of these need remedied.

I suspect proper boolean logic would greatly simplify this equation, but without some clue as to what it is supposed to accomplish I can't suggest a way how.

CM

##### Share on other sites
This is the logic that I am trying to put into an Excel formula:-

 if ( ( B4 == 4 && C4 == 8 ) ||       ( B4 == 8 && C4 == 4 ) ||       ( B4 == 8 && C4 == 0 ) ||       ( B4 == 0 && C4 == 8 ) ){	cout << “OK";}else{	cout << “Error";}

Thank you

##### Share on other sites
Quote:
 Original post by rpg_code_masterThis is the logic that I am trying to put into an Excel formula:-*** Source Snippet Removed ***Thank you

Look into AND and OR. I believe both take an arbitrary number of arguments, so your new function should be similar to this:
=IF(OR(AND(B4=4,C4=8), AND(...), ...), "OK", "ERROR")

CM

##### Share on other sites
Thanks,

Here is the final formula just for pure reference:-

=IF(OR(AND(B4=4,C4=8),AND(B4=8,C4=4),AND(B4=8,C4=0),AND(B4=0,C4=8)),1,0)

Compare it to:-

=IF(B4=8,IF(C4=4,"OK",IF(B4=8,IF(C4=0,"OK",$A$4),IF(B4=0,IF(C4=8,"OK",$A$4),$A$4)))),IF(B4=4,IF(C4=8,"OK",IF(B4=8,IF(C4=0,"OK",$A$4),IF(B4=0,IF(C4=8,"OK",$A$4),$A$4)))$A$4),$A$4)

I wonder which is more efficient...

• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

• 28
• 16
• 10
• 10
• 11
• ### Forum Statistics

• Total Topics
634111
• Total Posts
3015564
×