I see folks all the time showing formulas with "--" in them, such as =(--sum(.... What is the purpose of this? I assume something to do with absolute value but I am unsure.
Thanks for the insights!
I see folks all the time showing formulas with "--" in them, such as =(--sum(.... What is the purpose of this? I assume something to do with absolute value but I am unsure.
Thanks for the insights!
Last edited by learning_vba; 08-08-2011 at 12:53 PM. Reason: Solved ("--" forces strings to text for calculations)
This link gives a good explanation
On that page given above, search for double unary operator, that's what this is typically called.
Last edited by JBeaucaire; 08-08-2011 at 01:15 PM.
_________________
Microsoft MVP 2010 - Excel
Visit: Jerry Beaucaire's Excel Files & Macros
If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
Always put your code between code tags. [CODE] your code here [/CODE]
?None of us is as good as all of us? - Ray Kroc
?Actually, I *am* a rocket scientist.? - JB (little ones count!)
Hi,
I'll just add some colour to the terminology.
Unary means the operator operates on one operand. Double means that there are two operators. So, this would also be an example of a "double unary operator":
x%%
There are a few unary, arithmetic operators in Excel: -, % and + (which has no effect on the stack).
-- , in the context of --x, is a pair of unary minus operators. My take on it is here (curtosy of Nate Oliver). What is -- used for? It's used to coerce non-numeric types (such as strings representing numbers or logicals) into numbers.
Last edited by Colin Legg; 08-08-2011 at 01:25 PM.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks