Thursday, February 19, 2009

Minus Minus vs. *1 or ^1 or /1

'
Some operations in Excel will give you a simple “true” or “false.” For example:

=(A1=0)

Either ‘A1’ is equal to zero or it is not. So, you will get the actual words “TRUE” or “FALSE” in the cell. These kinds of operations are useful in long formulas if they are converted to their number counterparts; that is, 1 = true and 2 = false.
On the message boards, it is common practice to use minus minus to make this word-to-number conversion. For example:

=--(A1=0)

For those in the know it makes sense, but I think there is a better way. I like to use “*1.”

=(A1=0)*1

Multiplying by 1 gives the reader of your formula a better idea of what is going on and eliminates the weird spacing that the minus minus creates.

No comments:

Post a Comment