制作部分匹配的查询公式搜索框
Making a query formula search box with partial match
在此先感谢大家,
我有一个包含多个工作表的电子表格。我希望我的主工作表有一个基于从单元格引用的查询的搜索框(我的案例 A1)
*iv 设法做到了这一点,但搜索结果只是完全匹配。
有人可以帮忙吗如何使它成为部分匹配而不是完全匹配,甚至将两者结合起来。
**iv 试过这个线程,但它不起作用,也许我做错了什么
谢谢:
Exact result in Google Query, followed by partial match if exact result does not exist
这是目前有效的查询
=QUERY({sheet1!A2:I24;'sheet2'!A2:I26;'sheet3'!A2:I26},"select Col1, Col2, Col4,Col7,Col9 where Col1 = '"&A1&"'",1)
大家干杯,
来自reference:
like
- A text search that supports two wildcards: %
, which matches
zero or more characters of any kind, and _
(underscore), which matches
any one character. This is similar to the SQL LIKE operator. Example:
where name like fre% matches 'fre', 'fred', and 'freddy'
where Col1 like '%"&A1&"%'"
另一种更强大的方法是使用 filter
+ regexmatch
:
=filter({sheet1!A2:I24;'sheet2'!A2:I26;'sheet3'!A2:I26},
regexmatch({sheet1!A2:A24;'sheet2'!A2:A26;'sheet3'!A2:A26}, A1))
查看有关正则表达式语法的更多信息 here。
筛选的结果可能是查询数据源:
=query(filter(..., ...), "select Col1, ...")
在此先感谢大家, 我有一个包含多个工作表的电子表格。我希望我的主工作表有一个基于从单元格引用的查询的搜索框(我的案例 A1)
*iv 设法做到了这一点,但搜索结果只是完全匹配。 有人可以帮忙吗如何使它成为部分匹配而不是完全匹配,甚至将两者结合起来。
**iv 试过这个线程,但它不起作用,也许我做错了什么 谢谢:
Exact result in Google Query, followed by partial match if exact result does not exist
这是目前有效的查询
=QUERY({sheet1!A2:I24;'sheet2'!A2:I26;'sheet3'!A2:I26},"select Col1, Col2, Col4,Col7,Col9 where Col1 = '"&A1&"'",1)
大家干杯,
来自reference:
like
- A text search that supports two wildcards:%
, which matches zero or more characters of any kind, and_
(underscore), which matches any one character. This is similar to the SQL LIKE operator. Example:where name like fre% matches 'fre', 'fred', and 'freddy'
where Col1 like '%"&A1&"%'"
另一种更强大的方法是使用 filter
+ regexmatch
:
=filter({sheet1!A2:I24;'sheet2'!A2:I26;'sheet3'!A2:I26},
regexmatch({sheet1!A2:A24;'sheet2'!A2:A26;'sheet3'!A2:A26}, A1))
查看有关正则表达式语法的更多信息 here。
筛选的结果可能是查询数据源:
=query(filter(..., ...), "select Col1, ...")