What are dashes for

G

Guest

I spotted this in a questions and want to know what the dashes are for. I
have also seen dashes used in the SUMPRODUCT function. This is copied &
pasted to show entire question/answer

QUESTION:
=IF(AND(A4>="4/12/2006",A4<="9/12/2006"),"49")

This should show next week as 'Week 49' but doesn't. I want to add another
three IF to this string so that I can get the month sorted out in Week order?

ANSWER:
Try it as:
=IF(AND(A4>=--"4/12/2006",A4<=--"9/12/2006"),49)
 
B

Bernard Liengme

A logical expression returns with TRUE or FALSE (Boolean values); put a
number in A1 and try this formula =A1>5
When you perform an arithmetic operation on a Boolean Value, Excel treats
TRUE as 1 and FALSE as zero
Try =2*(A1>5)
So to keep just 1 or zero we could multiple by 1: =1*(A1>5)
Or we could negate the value twice =-(A1>5) returns with -1 or 0 while
=--(A1>5) will return either 1 or 0
In short, the double negation is the more efficient way to coerce Boolean
values to numeric values 1/0
For more read these
http://www.xldynamic.com/source/xld.SUMPRODUCT.html
http://mcgimpsey.com/excel/formulae/doubleneg.html
best wishes
 
G

Guest

they are double minus signs. used to convert the string into a numeric
value..for example

=--"4/26/2006"
is the same as
=38833

but is more visually understandable.
 
F

Fred Smith

The dashes are a double minus sign. They are used to convert a string into a
number, by forcing Excel to do arithmetic on it. You could just as easily add 0,
or multiply by 1, with the same result, but the standard has evolved to the
double minuses.
 

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

Top