简体   繁体   English

如何在包含星号的文本单元格上运行 Google 表格查询

[英]How to run Google-sheets query on text cell containing asterisk

When I use this query in Google sheets当我在 Google 表格中使用此查询时

=QUERY('Kontoutdrag länsförsäkringar'!$A$3:$F$1000186;"SELECT sum(F) WHERE B >= date'" & TEXT(DATEVALUE(J$4);"yyyy-mm-dd") & "' AND B <= date '"& TEXT(DATEVALUE(J$5);"yyyy-mm-dd") &"' AND D matches '" & JOIN("|";$T10:$CZ10) &"' AND D != '' label sum(F)'' ")

It will skip any cell that contains an asterisk somewhere in the text, the character它将跳过文本中某处包含星号的任何单元格,字符

*

The error is in this match part错误在这个匹配部分

AND D matches '" & JOIN("|";$T10:$CZ10)

If the D column's text (and the corresponding, identical cell in the join range) contains an asterisk it will not match.如果 D 列的文本(以及连接范围内相应的相同单元格)包含星号,则它将不匹配。

Is there a way to escape this so that I can have cells with the asterisk in the text?有没有办法避免这种情况,以便我可以在文本中使用带有星号的单元格?

This value will work这个值会起作用

K Batteriexp

This value will not be picked up by the query查询不会选取此值

K*Batteriexp

If asterisk is the only problem, You can escape it using regex:如果星号是唯一的问题,您可以使用正则表达式将其转义:

AND D matches '" & ARRAYFORMULA(JOIN("|";REGEXREPLACE($T10:$CZ10,"\*","\\*")))

This这个

K*Batteriexp //Means 'K' repeated 0 or more times

becomes变成

K\*Batteriexp //means a literal *

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

相关问题 在SSMS中,如何找到包含星号,某些文本,然后是另一个星号的字符串? - In SSMS, how can I find a string containing an asterisk, some text, then another asterisk? 具有多个单元格引用和 where 语句的 Google 表格查询函数 - Google Sheets Query Function with multiple Cell References and where statements Google 表格 SQL 查询 - 单元格引用返回记录 - Google Sheets SQL Query - Cell reference returns record 嵌套在查询(或ArrayFormula)(Google表格)中的文本处理 - Text Manipulation nestled within a Query (Or ArrayFormula) (Google Sheets) 谷歌表格查询功能不在 - Google Sheets Query Function not in 如何在 Google 表格中创建 =Query(query()) Function? - How do I create a =Query(query()) Function in Google Sheets? Google表格中的查询功能 - 根据另一列获取列中的非空最后一个单元格 - Query function in Google Sheets - Get non-empty last cell in a column depending on another column 尽管条件不满足,但查询返回范围内的第一个单元格(Google 表格) - Query returning 1st cell in range although condition is not met (Google Sheets) 如何在 Google 表格中使用 SQL 查询按子字符串分组 - How to use a SQL query in Google Sheets to group by a substring 文字字段Google表格查询 - Literal field Google Sheets QUERY
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM