What does "=--([Cell Reference])" do?
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. |
What does "=--([Cell Reference])" do?
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 On Sep 18, 4:10*pm, Ssverret wrote: 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. |
What does "=--([Cell Reference])" do?
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. -- HTH... Jim Thomlinson "Ssverret" wrote: 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. |
What does "=--([Cell Reference])" do?
"Pete_UK" wrote: 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 On Sep 18, 4:10 pm, Ssverret wrote: 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. 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 |
All times are GMT +1. The time now is 08:25 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com