如果查询中的语句

发布于 2025-01-26 18:46:34 字数 450 浏览 4 评论 0原文

我正在使用查询&像这样的Ingortrange组合:

=IFERROR(QUERY(IMPORTRANGE("https://docs.google.com/spreadsheets/d/1EizWsVwZfUy1NDRwmmWEpj2OxTGvBjP9-YBbds9xmr0/edit#gid=0", "'Locations'!A2:C"), "select Col3 where Col1='"&J4&"' and Col1<>''"))

但是,我希望它返回相关值:
col3如果值在col1中
col7如果值在col5中
Col11如果该值在Col9中

如果该值在一个以上的位置,则可能会丢弃错误,或者在第一次出现时返回结果,无论哪种方式都可以。

我正在尝试在查询中使用“ countif”来做到这一点,但没有很多运气。

I'm using a query & importrange combo like this:

=IFERROR(QUERY(IMPORTRANGE("https://docs.google.com/spreadsheets/d/1EizWsVwZfUy1NDRwmmWEpj2OxTGvBjP9-YBbds9xmr0/edit#gid=0", "'Locations'!A2:C"), "select Col3 where Col1='"&J4&"' and Col1<>''"))

But Instead of just searching column 1 and returning the associated value in column 3, I would like it to return the associated value in:
Col3 if the value is in Col1
Col7 if the value is in Col5
Col11 if the value is in Col9

It can throw an error if the value is in more than one place, or return the result at the first occurrence, either way is fine.

I'm trying to do this using "countif" within the query but am not having a much luck.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

人生百味 2025-02-02 18:46:34

尝试:

=IFERROR(QUERY({
 IMPORTRANGE("1EizWsVwZfUy1NDRwmmWEpj2OxTGvBjP9-YBbds9xmr0", "Locations!A2:C");
 IMPORTRANGE("1EizWsVwZfUy1NDRwmmWEpj2OxTGvBjP9-YBbds9xmr0", "Locations!E2:G");
 IMPORTRANGE("1EizWsVwZfUy1NDRwmmWEpj2OxTGvBjP9-YBbds9xmr0", "Locations!I2:K")}, 
 "select Col3 where Col1='"&J4&"' and Col1 is not null", ))

try:

=IFERROR(QUERY({
 IMPORTRANGE("1EizWsVwZfUy1NDRwmmWEpj2OxTGvBjP9-YBbds9xmr0", "Locations!A2:C");
 IMPORTRANGE("1EizWsVwZfUy1NDRwmmWEpj2OxTGvBjP9-YBbds9xmr0", "Locations!E2:G");
 IMPORTRANGE("1EizWsVwZfUy1NDRwmmWEpj2OxTGvBjP9-YBbds9xmr0", "Locations!I2:K")}, 
 "select Col3 where Col1='"&J4&"' and Col1 is not null", ))
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文