[英]Excel COUNTIF with link to another workbook
I am trying to get the count of records from a sheet in a different workbook. 我试图从另一个工作簿中的工作表中获取记录数。 I'm using the following formula: 我正在使用以下公式:
=COUNTIF('C:\Path\To\File\[WORK1.xlsm]SheetName'!$A:$A,"*")-1
NOTE: The file is an xlsM. It has a header row, that's why I'm subtracting 1
If I have the WORK1.XLSM file open at the same time as my 'Summary' workbook, then the numbers populate and are correct. 如果我在“摘要”工作簿中同时打开了WORK1.XLSM文件,则数字将填充且正确。 Once I close WORK1, I get #VALUE
in the cell. 关闭WORK1后,在单元格中将获得#VALUE
。
So 2 questions: 所以有两个问题:
Is there a reason this won't work? 有什么理由不起作用吗?
Is there a better way to write this? 有没有更好的方法来写这个?
Thanks for your consideration. 感谢您的考虑。
COUNTIF
不适用于封闭的工作簿,看起来您可以使用COUNTA,即
=COUNTA('C:\\Path\\To\\File\\[WORK1.xlsm]SheetName'!$A:$A)-1
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.