在 google 工作表中连接不同工作表的范围不适用于 sumif
concatenating ranges from different sheets not working with sumif in google sheets
背景
我正在 sheet 中编写脚本,它依赖于来自不同 sheet 的范围。例如,这条线使用 SUMIF:
效果很好
=sumif(accounting!$D:$D0,A2, accounting!$C:$C0)
问题
当我尝试添加由子范围组成的范围时(按照说明 here):
You can join multiple ranges into one continuous range using this same
punctuation. For example, to combine values from A1-A10 with the
values from D1-D10, you can use the following formula to create a
range in a continuous column: ={A1:A10; D1:D10}
像这样:
=sumif({accounting!D3:D6;accounting!D10:D16;accounting!D27:D28},
A2,
{accounting!C3:C6;accounting!C10:C16;accounting!C27:C28})
它给我以下错误
argument must be a range
注意
请记住这有效
=sumif({accounting!D3:D6;accounting!D10:D16;accounting!D27:D28},
A2,
accounting!C3:C6)
似乎只有当我向第三个参数添加一个范围时事情才会爆炸..想法?
sumif is a range
的第三个参数默认设置为这个公式。无法将其与数组一起使用。
您可以使用sum + filter
=round(sum(filter({accounting!C3:C6;accounting!C10:C16;accounting!C27:C28},
{accounting!D3:D6;accounting!D10:D16;accounting!D27:D28}=A2)), 1)
不确定 Excel,这仅适用于 Google 电子表格。这里是 sample sheet
背景
我正在 sheet 中编写脚本,它依赖于来自不同 sheet 的范围。例如,这条线使用 SUMIF:
效果很好=sumif(accounting!$D:$D0,A2, accounting!$C:$C0)
问题
当我尝试添加由子范围组成的范围时(按照说明 here):
You can join multiple ranges into one continuous range using this same punctuation. For example, to combine values from A1-A10 with the values from D1-D10, you can use the following formula to create a range in a continuous column: ={A1:A10; D1:D10}
像这样:
=sumif({accounting!D3:D6;accounting!D10:D16;accounting!D27:D28},
A2,
{accounting!C3:C6;accounting!C10:C16;accounting!C27:C28})
它给我以下错误
argument must be a range
注意
请记住这有效
=sumif({accounting!D3:D6;accounting!D10:D16;accounting!D27:D28},
A2,
accounting!C3:C6)
似乎只有当我向第三个参数添加一个范围时事情才会爆炸..想法?
sumif is a range
的第三个参数默认设置为这个公式。无法将其与数组一起使用。
您可以使用sum + filter
=round(sum(filter({accounting!C3:C6;accounting!C10:C16;accounting!C27:C28},
{accounting!D3:D6;accounting!D10:D16;accounting!D27:D28}=A2)), 1)
不确定 Excel,这仅适用于 Google 电子表格。这里是 sample sheet