A B C D E F G H I
+--------+------+-------+------+-------+---+---------+------+--------------+
1 | Select | Name | Price | URL | Desc | - | Select | Name | Price(13.97) |
+--------+------+-------+------+-------+---+---------+------+--------------+
2 | x | n2 | 4.99 | url2 | desc2 | - | x | n2 | 4.99 |
+--------+------+-------+------+-------+---+---------+------+--------------+
3 | | n3 | 3.99 | url3 | desc3 | - | x | n6 | 3.99 |
+--------+------+-------+------+-------+---+---------+------+--------------+
4 | | n4 | 7.99 | url4 | desc4 | - | x | n9 | 4.99 |
+--------+------+-------+------+-------+---+---------+------+--------------+
5 | | n5 | 4.99 | url5 | desc5 | - | | | |
+--------+------+-------+------+-------+---+---------+------+--------------+
6 | x | n6 | 3.99 | url6 | desc6 | - | | | |
+--------+------+-------+------+-------+---+---------+------+--------------+
7 | | n7 | 4.99 | url7 | desc7 | - | | | |
+--------+------+-------+------+-------+---+---------+------+--------------+
8 | | n8 | 3.49 | url8 | desc8 | - | | | |
+--------+------+-------+------+-------+---+---------+------+--------------+
9 | x | n9 | 4.99 | url9 | desc9 | - | | | |
+--------+------+-------+------+-------+---+---------+------+--------------+
鉴于上面的表A1:E9
,我想生成列G:I
我成功地使用I1
这个公式得到了一个类似的结果(没有p {和G1
中的价值):
=Query(A:E, "SELECT A, B, C WHERE A CONTAINS 'x' ORDER BY B ASC",1)
问题是:如何将所选行的总和添加到最后一列的标题中,如示例所示?
提前谢谢你:)
答案 0 :(得分:4)
您可以将其分解为单独的部分,而不是尝试在一个查询中执行此操作。
在单元格G2中,使用查询:
=Query(A:E, "SELECT A, B, C WHERE A CONTAINS 'x' ORDER BY B ASC label A '', B '', C '' ", 1)
这将返回没有列标题的查询,然后您只需填写" name"和"选择"列标题手动进入G1和H1。然后对于单元格I1使用
=CONCATENATE("Price (", SUM(I2:I), ")")