• Advertisement
Sign in to follow this  

Excel Formula syntax error

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

If you intended to correct an error in the post then please contact us.

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 this post


Link to post
Share on other sites
Advertisement
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 this post


Link to post
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 this post


Link to post
Share on other sites
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

Share this post


Link to post
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...

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement