LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,118
Default Purpose of "--" Operator

When you use a Boolean formula (a formula that returns TRUE or FALSE), Excel
returns those values, which are not numeric. If the formula returns "numeric
text",
Excel will treat it AS text. To coerce the conversion from Boolean to
Numeric, or
from "numeric text" to Numeric, you need to apply an arithmetic operator. The
generally accepted convention is to use a double minus sign (--).

It works this way:
The negative of a value reverses the sign.
The negative of that value restores the sign.

Example:
RIGHT("W1000",4) returns with the *word* "1000"
-RIGHT("W1000",4) converts "1000" to the negative number -1000
--RIGHT("W1000",4) converts the negative number to the positive number 1000

In the case of boolean values, the dbl-neg converts TRUE and FALSE to 1 and
0, respectively.

Example:
--ISNUMBER(56) converts TRUE to the number 1
--ISNUMBER("this is text") converts FALSE to the number 0

You could achieve the same results by multiplying a value by 1, but the
dbl-neg indicates to knowledgable users that a "type conversion" is being
effected.

Does that help?
***********
Regards,
Ron

XL2002, WinXP


"roadkill" wrote:

I sometimes look at the questions posed (and, of course, the answers) in this
Discussion Group to try and learn new things about Excel. Recently, in a
couple of places, I saw "--" used in formulas. It appears that its purpose
is to convert a logical True or False into a number (1 or 0). Is this
correct?

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Text "comparison" operator for "contains" used in an "IF" Function Pawaso Excel Worksheet Functions 4 April 4th 23 11:35 AM
LOGICAL OPERATOR "IF" FOR AN ARRAY FARAZ QURESHI Excel Discussion (Misc queries) 0 January 19th 07 08:19 PM
LOGICAL OPERATOR "IF" FOR AN ARRAY Prasadkakarla Excel Discussion (Misc queries) 0 January 19th 07 08:14 PM
Is it possible to apply IF's to "operator" result.. nastech Excel Discussion (Misc queries) 3 August 11th 06 02:12 PM
program stuck at "Save Cancelled by Operator" MainelyPat Excel Discussion (Misc queries) 3 April 20th 06 06:23 PM


All times are GMT +1. The time now is 05:54 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"