为什么这个使用 MOD 和 ROW() 的简单 Excel 公式会出错

TRo*_*ano 6 microsoft-excel

我正在尝试在选择上设置交替行样式。我单击第一行并向下拖动到第 145 行(数据结束的地方)。

然后我进入条件格式,选择新规则,并尝试输入这个公式:

=MOD(ROW(),2)=0
Run Code Online (Sandbox Code Playgroud)

当我单击“确定”时,我在 Excel 2016 中收到了这个不太有用的错误:

There's a problem with this formula. 
Not trying to type a formula? When the first character is 
an equal (=) or minus (-) sign, Excel thinks it's a formula.
<snip>
Run Code Online (Sandbox Code Playgroud)

公式有什么问题?

小智 6

尝试使用“;” 而不是数字前的“,”。

背景:某些语言环境使用不是逗号字符的“列表分隔符”字符。如果您在美国境外,这可能是您的情况。

详情请见: http : //datapigtechnologies.com/blog/index.php/why-your-version-of-excel-only-accept-semicolons-in-formulas-instead-of-commas/


小智 2

只需拆下该=0部件即可正常工作。

创建规则时,选择选项Use a formula to determine which cells to format,然后输入以下公式:

=MOD(ROW(),2)
Run Code Online (Sandbox Code Playgroud)

如果要格式化另一组行,请使用以下命令:

=MOD(ROW(),2)-1
Run Code Online (Sandbox Code Playgroud)