meaning of -- in the formulas

G

Guest

Hi all,

does anybody know the meaning of "--" in a formula?

for example:
=IF(SUMPRODUCT(--(B4:B5=B5))=1;1;0)


thanks a lot!
Massimo
 
K

keepITcool

Massimo,

the -- is called a unary minus and used to force a conversion from
booleans to numbers. Many array oriented functions work better with
numbers than with booleans and the guru's have found it faster than n().

--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam


max wrote :
 
A

Aladin Akyurek

max said:
Hi all,

does anybody know the meaning of "--" in a formula?

for example:
=IF(SUMPRODUCT(--(B4:B5=B5))=1;1;0)


thanks a lot!
Massimo

Don't be seduced to invoke SumProduct when unnecessary, even costly...

The goal of your formula can be achieved with...

=IF(COUNTIF(B4:B5,B5)=1;1;0)

Even shorter...

=(COUNTIF(B4:B5,B5)=1)+0

=--(COUNTIF(B4:B5,B5)=1)
 

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