Double-Hyphen Criteria Notation

15 views
Skip to first unread message

Helman Frow

unread,
Jul 9, 2023, 11:35:40 AM7/9/23
to Google Sheets Community
Today I was trawling the interwebs for a particular solution and across a page with a very cool syntax I'd never seen before:


=SUMPRODUCT(--(A2:A12="value"), C2:C12, D2:D12) 



That double-hyphen phrase inserted into SUMPRODUCT() acts as a criteria match. 🤯

I'm entire unfamiliar with this technique and I'm hoping someone can shed some light on what it's called or where it's referenced.

Helman Frow

unread,
Jul 15, 2023, 11:42:15 AM7/15/23
to Google Sheets Community
It's okay, fam, I got the answer I was after. The double hyphen is actually a double minus sign. It's a boolean operator used to coerce a 1 or 0 from a TRUE or FALSE value.

Alexander Ivanov

unread,
Jul 21, 2023, 3:20:35 PM7/21/23
to Google Sheets Community
Hi Helma!

It's not what you expect for.

Double minus is a type casting to numbers 0 or 1.

1689967067510.png


Cheers!
Reply all
Reply to author
Forward
0 new messages