Purpose of Double Unary in AND Statement

D

Daren

Hello,

The AND statement is as follows:

=and(--d2>--c2,--c2>--b2m--b2>--a2).

What's the purpose of the double unary here?

Thanks!
 
K

krcowen

Daren
The -- can be used to cause Excel to convert strings that look like
numbers to numbers; which will allow the numeric calculations to
work. It serves the same purpose as the N() function.
That would be my guess.
Ken
 
T

T. Valko

It could be because the referenced cells contain TEXT numbers. The "--" will
coerce TEXT numbers to NUMERIC numbers.
 
B

Bernard Liengme

When Excel is asked to do an arithmetic operation ( add, multiply, etc)
Boolean values (True or False), it treats TRUE as 1 and False as 0. The
double negation (please note that ++ is also double unary) is one such
arithmetic operation.
It does the same thing if the cell has text that can be represented as a
number.
But it is not clear what the purpose is in the example. Can you tell us what
is in the cells?
best wishes
 
D

David Biddulph

If A2:B2 contain text which looks like dates, the double unary minus will
convert them to real dates.
Note also that your formula has an m that ought to be a comma.
Note also that "double unary" by itself isn't a very specific term:
-- is a double unary minus
++ would be a double unary plus.
 
B

Bernard Liengme

David,
Can I be a nit-picker?

In (4 - 2) we are have 4 minus 2 (or 4 subtract 2) but in -4 we are not
doing any subtraction, rather we are negating 4 (in -x this amounts to
changing the sign of x)
So I like to use the term "double negation" or "double unary negation" but
since negation is a unary op the middle word is redundant

Sorry, but in retirement I must be missing my students to pick on !!!
best wishes from Canada
 
D

Daren

Those cells have dates in them. They're supposed to be formatted as
3/14/2001 but sometimes they have an extra slash in them, so I change them
with find/replace to format as 3/14/2001
 
D

Daren

Thanks.

Bernard Liengme said:
When Excel is asked to do an arithmetic operation ( add, multiply, etc)
Boolean values (True or False), it treats TRUE as 1 and False as 0. The
double negation (please note that ++ is also double unary) is one such
arithmetic operation.
It does the same thing if the cell has text that can be represented as a
number.
But it is not clear what the purpose is in the example. Can you tell us what
is in the cells?
best wishes
--
Bernard V Liengme
Microsoft Excel MVP
http://people.stfx.ca/bliengme
remove caps from email
 
D

Daren

Thanks!


Daren
The -- can be used to cause Excel to convert strings that look like
numbers to numbers; which will allow the numeric calculations to
work. It serves the same purpose as the N() function.
That would be my guess.
Ken
 
D

Daren

Thanks.

David Biddulph said:
If A2:B2 contain text which looks like dates, the double unary minus will
convert them to real dates.
Note also that your formula has an m that ought to be a comma.
Note also that "double unary" by itself isn't a very specific term:
-- is a double unary minus
++ would be a double unary plus.
 

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