在 google 个工作表中引用不包含在范围内的查询函数中的单元格

Referencing a cell in query function not included in range in google sheets

我正在尝试编写一个查询函数,该函数从不同 sheet 上的列中选择一个值,其中来自相同 sheet 的不同列等于目标 sheet.

这是我尝试用代码展示这一点的尝试:

=QUERY(OtherSheet!D:E,"Select E where (D = D8)")

D8 是我要引用的目标 sheet 中的单元格。

应该是:

=QUERY(OtherSheet!D:E, "select E where D = "&D8)

如果D8是一个数值


否则,如果 D8 是纯文本,它应该是:

=QUERY(OtherSheet!D:E, "select E where D = '"&D8&"'")