具有下拉菜单+多个条件的Google表格查询

问题描述 投票:0回答:2

我在选项卡上有这种表(称为“日志” ::

A     B     C     D    E   F    G    H
a1    b1    c1    d1   5   f1   g1   h1
a2    b1    c2    d1   3   f2   g2   
a3    b2    c1    d2   4   f3   g3   h2
a4    b1          d1   5   f4   g4 
a5    b2    c3    d1   3   f5   g5   h3

在同一文件的另一个选项卡(称为“监视”)上,我具有一个带有所有“ D”的dropdwon菜单。

我正在尝试使用“监视”选项卡上的QUERY功能来可视化C,E,G和H。只有在“ E”介于“ 1”和“ 3”。

我最接近的是这个:

=QUERY(Log!B:H, "SELECT C,E,H,G WHERE D='"&B1&"' and H is not null and E<=3")

但是它仅显示“ E”在<= 3的位置,而忽略了下拉菜单中的选择(WHERE D ='“&B1&”')

google-sheets dropdown google-sheets-formula google-sheets-query google-query-language
2个回答
1
投票
=QUERY(Log!B:H, "select C,E,H,G where lower(D) = '"&TRIM(LOWER(B1))&"' and H is not null and E<=3", 0)

0
投票
=filter({Log!C1:C5,Log!E1:E5,Log!H1:H5,arrayformula(if((Log!H1:H5="")*(Log!E1:E5<=3),Log!G1:G5,""))}, Log!D1:D5="d1")

=filter({Log!C1:C5,Log!E1:E5,Log!H1:H5,arrayformula(if((Log!H1:H5="")*(Log!E1:E5<=3),Log!G1:G5,""))}, Log!D1:D5 = B1)

结果:

c1  5   h1  
c2  3       g2
    5       
c3  3   h3  
© www.soinside.com 2019 - 2024. All rights reserved.