简体   繁体   English

如何在电子表格和相对单元格引用中使用查询

[英]How to use query with spreadsheet and relative cell reference

PROBLEM: I am trying to use queries in google spreadsheets with a relative cell reference.问题:我试图在带有相对单元格引用的 google 电子表格中使用查询。 What I am trying to do: Filter a spreadsheet tab 'website!'我想要做的是:过滤电子表格选项卡“网站!” for the content in a cell 'Dashboard Table!$B$1' and give the content of the whole row in the sheet 'website!'.对于单元格“仪表板表!$B$1”中的内容,并在工作表“网站!”中给出整行的内容。

Here is my original formular without queries: =IF(isblank($B$1), ARRAYFORMULA(Website!A16:D1000), FILTER(Website!A16:D$1000, Website!$C16:$C$1000=$B$1)) that worked fine.这是我没有查询的原始公式: =IF(isblank($B$1), ARRAYFORMULA(Website!A16:D1000), FILTER(Website!A16:D$1000, Website!$C16:$C$1000=$B$1))效果很好。

What I am trying now: =QUERY(Website!A16:D, "select A WHERE C="&B1&"", -1) not working at all returning #value!.我现在正在尝试的是: =QUERY(Website!A16:D, "select A WHERE C="&B1&"", -1)根本不工作返回#value!。

Sorry I am new to queries.对不起,我是新来的查询。 Can anyone advice?任何人都可以建议吗?

Ok, so what did it for me is:好的,那么对我来说是什么:

=QUERY(Website!$A16:$D, "select A WHERE (C='"&$B$1&"' OR B contains '"&$B$1&"')", -1)

Problem was the order in which I had the " and '... I guess that depends on the language you set your google spreadsheets in.问题是我使用 " 和 ' 的顺序......我想这取决于你设置谷歌电子表格的语言。

=QUERY(sheet1!1:999;"SELECT * WHERE F contains '"&$A$1&"' ";1)

Just copy formula to A2 cell.只需将公式复制到 A2 单元格即可。

When you write something in A1 cell and hit enter it finds everything in sheet1 that contains A1 cell.当您在 A1 单元格中写入内容并按 Enter 键时,它会在 sheet1 中找到包含 A1 单元格的所有内容。

Worked for me (some computers use comma, instead of this ';').为我工作(有些计算机使用逗号,而不是这个“;”)。

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

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