Google表格-查询包含数组 [英] Google Sheets - query contains array

查看:128
本文介绍了Google表格-查询包含数组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有名称列的范围.

I have a range with a name column.

我还列出了要列出的姓名.

I also have a list of names chosen be presented.

我想运行一个查询,仅当其名称在此列表内时才会从该范围中选择数据:

I want to run a query which will select data from this range only if it names is inside this list:

Select C Where A "is in the selected array of names"

正确的做法是什么?

推荐答案

假设名称数组为D2:D10;那么您可以使用查询字符串

Suppose the array of names is D2:D10; then you could use the query string

"select C where A = '" & join("' or A = '", D2:D10) & "'"

这将创建一个长查询字符串A ='name'或A ='another name'...

This creates a long query string A = 'name' or A= 'another name'...

如果名称范围是可变的(例如,您要在D2:D中列出所有名称),请用filter(D2:D, len(D2:D))替换D2:D10.

If the range of names is variable (e.g., you want all names listed in D2:D), replace D2:D10 with filter(D2:D, len(D2:D)).

这篇关于Google表格-查询包含数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆