我在Excel VBA中使用此公式来插入CountIFS()
公式,但返回的计数始终为0?
这是我正在使用的VBA语法:(我将它格式化为在逗号后添加空格以便在此窗口中更好看,在我的VBA中它只是一行)
With ws
.Range("C2:C" & lr).FormulaR1C1 = "=COUNTIFS(Students!C[-2],RC[-2],
Students!C,""<>James"",
Students!C,""<>Joanne"",
Students!C,""<>Lisa"",
Students!C,""<>Marin"",
Students!C,""<>Alfie"",
Students!C,""<>Parent Volunteer"",
Students!C[6],""'Current"")
End with
如果我在VBA将其输入到单元格之后查看公式,那么它就是这样的:
=COUNTIFS([Students.xlsx]Names!A:A,A2,
[Students.xlsx]Names!C:C,"<>James",
[Students.xlsx]Names!C:C,"<>Joanne",
[Students.xlsx]Names!C:C,"<>Lisa",
[Students.xlsx]Names!C:C,"<>Marin",
[Students.xlsx]Names!C:C,"<>Alfie",
[Students.xlsx]Names!C:C,"<>Parent Volunteer",
[Students.xlsx]Names!I:I,"Current")
这看起来像正确的语法。我需要更改此语法以便提供准确的计数?