尝试在Google论坛中的QUERY结果中添加更多列 [英] Trying to include additional columns in QUERY result on GoogleSheets

查看:142
本文介绍了尝试在Google论坛中的QUERY结果中添加更多列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Google表格,并且没有任何问题使用以下公式:

I'm using Google Sheets and using the following formula without any issue:

=QUERY(Sheet!A:D,"select A, max(B) where not B is null group by A label A 'Client', max(B) 'Most Recent'")

显然,这是返回引用数据
的列A和B但是,我想还要返回列C中相应的单元格。

Obviously, this is returning columns A and B of the referenced data However, I would like to also return the corresponding cells from column C.

的示例数据: HTTPS:/ /docs.google.com/spreadsheets/d/1CJKiDNPUWMMUbLLb-UDA6iRA2PBnlMHDsEB9vELe0Rk/edit?usp=sharing

使用这个例子,我想看看是什么细胞G2填充披萨(即从C3),等等。

Using this example, what I would like to see is cell G2 populated with "Pizza" (i.e., from C3), and so on.

我是否使用正确的公式?我需要改变什么?

Am I using the right formula? What do I need to change?

推荐答案

这是我最终完成的工作。

Here is what I did that finally worked.

在E1中,输入 = unique(A:A)以获取唯一客户名称的列表。在F2中,输入

In E1, enter =unique(A:A) to get the list of unique client names. In F2, enter

=query(A$2:D101, "select B,C,D where A ='"&F2&"' order by B desc limit 1")

并将此公式向下拖动。这将选择所有具有与E2匹配的A值的行,并选择具有最大B值的行。

and drag this formula down. This selects all rows with the A value matching E2, and picks one with maximal B value.

您不希望在这些查询的输出中包含标题行所以只需在标题行中添加所需的文本。

You don't want to have a header row in the output of these queries so just add desired text in header row.

这篇关于尝试在Google论坛中的QUERY结果中添加更多列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆