簡體   English   中英

Google 表格 countunique + query + importrange = 語法錯誤

[英]Google Sheets countunique + query + importrange = syntax error

=countunique(query({importrange("https://docs.google.com/spreadsheets/d/1suCxx5n9KafFT8aIpS8VDWQdTbquepR9z5U099mlkNE/edit#gid=1167025375";"C1300:F3000"});"select col1 where col3 = '"PRI"' & col4 = '"A165"' "))

結果 - 語法錯誤。 為什么?

訪問被授予。 A165 是導入表的單元格。

Col1而不是col1

)}; 而不是});

'PRI'而不是"'PRI'"

and不是&

還將工作表名稱添加到C1300:F3000

嘗試:

=COUNTUNIQUE(QUERY({IMPORTRANGE(
 "1suCxx5n9KafFT8aIpS8VDWQdTbquepR9z5U099mlkNE"; "C1300:F3000")};
 "select Col1 
  where Col3 = 'PRI' 
    and Col4 = '"&A165&"'"))

你的公式:

=countunique(query({importrange("https://docs.google.com/spreadsheets/d/1suCxx5n9KafFT8aIpS8VDWQdTbquepR9z5U099mlkNE/edit#gid=1167025375";"C1300:F3000"});
  "select col1 where col3 = '"PRI"' & col4 = '"A165"' "))

修正公式:

=countunique(query({importrange("https://docs.google.com/spreadsheets/d/1suCxx5n9KafFT8aIpS8VDWQdTbquepR9z5U099mlkNE/edit#gid=1167025375";"C1300:F3000")};
  "select col1 where col3 = 'PRI' & col4 = '" & A165 & "' "))

這需要文本字符串之間的“&”(與號) - 假設 A165 的內容是一個字符串 - 在公式的末尾,並在 select 之前將"})"更改為")}" 在使用“}”關閉數組之前,您需要關閉 IMPORTRANGE function。

如果 A165 具有數值,則必須刪除單引號。

& col4 = " & A165 & "))

還刪除了 PRI 周圍的雙引號。 col3 = '"PRI"'col3 = 'PRI'

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM