this post was submitted on
12 points (87% like it)
14 up votes 2 down votes
all 5 comments

[–]---sniff---Why not Access? 6 points7 points ago

I would argue for "AND/OR" in almost all situations because it is significantly easier for the next guy to follow the logic.

[–]spikeyfreak 0 points1 point ago

Ha, this is good stuff. Wish I had thought of it.

[–]petedacook 1 point2 points ago*

The "IF" condition evaluates to 1 if true, and 0 if false.

This is not correct. It evaluates to "true," if true, or "false" if false. Literally.

Type 1 in cell A1

Then type , =IF(A1=5,"your wrong")

This will evaluate to false, and "false" will literally be displayed.

Take it a step further and put this in cell C1:

=IF(B1=0,"you're wrong","correct")

Take it another step and put this formula in cell C1:

IF(--B1=0,"you're correct","You're wrong")

This "--" turns "false" into 0, or "true" into 1. NMultiply by 1 and get the same result:

** IF(B11=0,"you're correct","You're wrong")*

You would need to convert that to a 0 (false) or 1 (true) using a formula. For example: --"False"

For example:

put this in a cell:

=--false And it will return 0

while

=--true

will return 1

This becomes more important when you begin working with complex array formulas.

See video illustration here

[–]maoru[S] 0 points1 point ago

Thank you for the clarification. I treat it as 1 and 0 because it multiplies and adds that way.

[–]BenCrouch 0 points1 point ago

To rephrase what petedacook was saying, The IF function returns a Boolean value of TRUE or FALSE. Whilst arithmetic functions will treat TRUE as 1, and FALSE as 0, Logical or Comparison functions will not.

Using a double negative with a Boolean value just preforms a self-cancelling operation to return the decimal representation of the boolean value.

As it says in the caption of the "video illustration", you could also use

TRUE*1, TRUE+0, TRUE/1.