Eli*_*eth 5 sum google-sheets google-sheets-query google-sheets-formula
我的查询产生错误
#N/A查询已完成,输出为空。
=sum((query(importrange("mysheet","CR"),"select Col7 where Col1 ='"&A4&"' and Col2 ='"&B4&"' and Col13!='Cancelled' and Col13!='Rejected' ",0)))
Run Code Online (Sandbox Code Playgroud)
当引用的工作表中存在数据时,该功能可以正常工作。问题是当我将其向下拖动时,CR 数据集中不存在某些列引用。如何填充零而不是错误?
如果发生错误,您需要IFERROR像这样使用,这将导致 0:
=SUM(IFERROR(QUERY(IMPORTRANGE("mysheet","CR"),
"select Col7
where Col1 ='"&A4&"'
and Col2 ='"&B4&"'
and Col13!='Cancelled'
and Col13!='Rejected' ", 0)))
Run Code Online (Sandbox Code Playgroud)