Excel Formula syntax error
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.
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
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
This is the logic that I am trying to put into an Excel formula:-
Thank you
if ( ( B4 == 4 && C4 == 8 ) || ( B4 == 8 && C4 == 4 ) || ( B4 == 8 && C4 == 0 ) || ( B4 == 0 && C4 == 8 ) ){ cout << “OK";}else{ cout << “Error";}
Thank you
Quote:Original post by rpg_code_master
This 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
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...
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...
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement