What does "=--([Cell Reference])" do?

  • Thread starter Thread starter Ssverret
  • Start date Start date
S

Ssverret

I've seen some posts referencing a spreadsheet function I've never seen
before. The function is two dashes "--" followed by a cell or range
reference. I've played with it a little bit, but can't find out exactly what
it is supposed to do, because it does different things in different places.
I'm not using it for anything, I just like to learn new things.
 
The double unary minus (--) converts TRUE and FALSE values to 1s and
0s respectively, so that they can be used in normal arithmetic. It can
also be used to convert numbers which are text values into proper
numbers.

Hope this helps.

Pete
 
That is actual double negation. It is used to coerce non numbers into numbers
or to coerce true / false into 1 and 0.

You can do the same thing by multiplying by 1 or such but the nice part of
double negation is that it is an immediate clue that you need to coerce
something to a number as opposed to perform a mathematic operation to it.
 
Pete_UK said:
The double unary minus (--) converts TRUE and FALSE values to 1s and
0s respectively, so that they can be used in normal arithmetic. It can
also be used to convert numbers which are text values into proper
numbers.

Hope this helps.

Pete
Thanks for your help Pete and Jim, I tried it a few times and it worked
perfectly. I had a previous method for turning text into numbers, but this
one is better. Steve
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top