ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   meaning of -- in the formulas (https://www.excelbanter.com/excel-worksheet-functions/9692-meaning-formulas.html)

max

meaning of -- in the formulas
 
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

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 :

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


Bob Phillips

Massimo,

Take a look at http://www.xldynamic.com/source/xld.SUMPRODUCT.html

--

HTH

RP
(remove nothere from the email address if mailing direct)


"max" wrote in message
...
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




Aladin Akyurek

max wrote:
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)



All times are GMT +1. The time now is 05:46 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com