简体   繁体   English

ARRAYFORMULA、QUERY 和 IMPORTRANGE 仅显示单行的结果

[英]ARRAYFORMULA, QUERY, and IMPORTRANGE is only displaying results for a single row

I am wondering if there is an issue with my formula because its not filling the entire column like an array should.我想知道我的公式是否有问题,因为它没有像数组那样填充整个列。

Currently my formula is working perfectly with B2, but its not working for the entire range B2:B.目前我的公式与 B2 完美配合,但不适用于整个 B2:B 范围。

Here is my formula:这是我的公式:

=ARRAYFORMULA(QUERY({
 {IMPORTRANGE("URL TO PRIVATE SHEET","$L2:$O")} 

},"select Col4 WHERE Col1 CONTAINS " & $A2:A))

The IMPORTRANGE sheet looks like... https://docs.google.com/spreadsheets/d/1GFnkuE3Dx-rTuvEV6wj1mCEq3P6cOxbzYco4aFVNw-I/edit?usp=sharing IMPORTRANGE 表看起来像... https://docs.google.com/spreadsheets/d/1GFnkuE3Dx-rTuvEV6wj1mCEq3P6cOxbzYco4aFVNw-I/edit?usp=sharing

|   L    |M|N|        O         |
| 000001 |*|*|JohnDoe@email.com |
| 000002 |*|*|JaneDoe@email.com |
| 000003 |*|*|BobDoe@email.com  |

The ARRAYFORMULA is in B2 https://docs.google.com/spreadsheets/d/1JaWUWS3xKOwSX9y7uWUqEU5_Knp8nRgnhlVa1kRNlTo/edit?usp=sharing ARRAYFORMULA 在 B2 https://docs.google.com/spreadsheets/d/1JaWUWS3xKOwSX9y7uWUqEU5_Knp8nRgnhlVa1kRNlTo/edit?usp=sharing

|   A    |        B          |
| 000003 |  BobDoe@email.com | <- Contains the formula above and works.
| 000001 |        *          | <- No data: should say "JohnDoe@email.com"
| 000002 |        *          | <- No data: "JaneDoe@email.com"

Is this a limitation in Google Sheets?这是 Google 表格的限制吗? Thanks!谢谢!

you cant have array in 2nd argument of query like that.你不能在这样的查询的第二个参数中有数组。 try perhaps:也许试试:

=ARRAYFORMULA(QUERY({{IMPORTRANGE("URL TO PRIVATE SHEET", "L2:O")}},
 "select Col4 
  where Col1 matches '"&TEXTJOIN("|", 1, A2:A)&"'"))

update:更新:

=ARRAYFORMULA(IFNA(VLOOKUP(A2:A, QUERY({
 {IMPORTRANGE("1GFnkuE3Dx-rTuvEV6wj1mCEq3P6cOxbzYco4aFVNw-I", "L2:O")}},
 "select Col1,Col4 
  where Col1 is not null", 0), 2, 0)))

在此处输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM