What does — (minus minus) do in Excel? [duplicate]

我只是一个虾纸丫 提交于 2019-12-25 18:38:28

问题


In Excel I have two cells

A1 Gwen Stefani
B1 =SUMPRODUCT(--(A1:A10="Gwen Stefani"))

B1 records a value of 1 (it counts "Gwen Stefani" in cell A1)

My question is this: What is the -- operator called, for want of a better word, and what does it do?

  • Naturally looking up "--" in Excel help gets me 50,200 results of - which isn't helpful ;)

回答1:


The (A1:A10="Gwen Stefani") evaluates to an array (TRUE, FALSE, FALSE, FALSE...). So you are multiplying it by 1 to get (1,0,0,...). The "- -" can be replaced by "1*" with the same result.



来源:https://stackoverflow.com/questions/39268369/what-does-minus-minus-do-in-excel

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!