什么 - 在 Excel 公式中做什么? [英] What does -- do in Excel formulas?
问题描述
试图破译一些 Excel 公式,我看到了一些类似 SUMPRODUCT(--Left(...)...) 的东西
Trying to decipher some Excel formulas and I see some stuff like SUMPRODUCT(--Left(...)...)
-- 在做什么?在我看来自然是递减,但找不到任何相关文档.
What is the -- doing? Naturally seems like decrementing to me but couldn't find any documentation on it.
推荐答案
双破折号被称为双一元运算符.
The double-dash is known as a double unary operator.
试试这个链接:为什么在 SUMPRODUCT 公式中使用 --
特别是:
SUMPRODUCT() 忽略非数字条目.比较返回一个布尔值 (TRUE/FALSE),它是非数字的.XL 在算术运算(例如,TRUE + 0 = 1)中自动将布尔值强制转换为数值(分别为 1/0).
SUMPRODUCT() ignores non-numeric entries. A comparison returns a boolean (TRUE/FALSE) value, which is non-numeric. XL automatically coerces boolean values to numeric values (1/0, respectively) in arithmetic operations (e.g., TRUE + 0 = 1).
强制值的最有效方法是首先应用一元减号运算符,将 TRUE/FALSE 强制为 -1/0,然后再次应用它来否定值,例如 +1/0.
The most efficient way to coerce the value is first to apply the unary minus operator, coercing TRUE/FALSE to -1/0, then applying it again to negate the value, e.g., +1/0.
单个一元运算符 (-) 将 true/false 值强制转换为 -1/0.通过使用双一元运算符,我们再次将值强制为 1/0.
A single unary operator (-) coerces true/false values into -1/0. By using the double unary operaor, we coerce the values again to 1/0.
这篇关于什么 - 在 Excel 公式中做什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!