Maxif的阵列公式

发布于 2025-01-26 15:01:20 字数 1386 浏览 4 评论 0原文

我觉得我的问题应该很容易弄清楚,但是我环顾四周,似乎找不到如何获得产生最大值的基本阵列溢出功能。这是我简化的数据集:

Col ACol B
Apple864
胡萝卜189
256
Apple975
873
胡萝卜495
Apple 95 Apple95
PEAR36
胡萝卜804

我的目标是拥有独特的食物清单(来自col A) ,从col b返回最大对应值。 的公式unique来自col A的列表很容易... = unique(filter(a:a:a,a:a:a&lt;&gt;'“”)))< /code>,我正在努力的是获得动态maxifs与此保持一致。

为了说明,如果我将唯一函数放在单元d2中(因此,它将溢出到d4,如下所示,如下所示),则正确的相应的非阵列函数将为<代码> = maxifs(b:b,a:a,d2)(列E中显示)。我可以将其拖到剩余的行中,但我希望这是动态的,因为将来我的数据集可能会有更多食物。

我会期望工作的是... = filter(maxifs(b:b,a:a,d2:d),d2:d&lt;&gt;“”)但这返回#value!。相比之下,如果我要使用sumif/平均值,= filter(sumif(a:a,d2:d,b:b),d2:d&lt;&gt;&gt;“”),我得到了什么我希望(这真的使我感到困惑)。

是否有一种方法可以获取动态MaxIF(或在列中产生同等值的任何函数)会根据D列中的唯一值溢出?

I feel like my question should be easy to figure out, but I've looked around and can't seem to find out how to get a basic array spill function that produces the max value. Here's my simplified data set:

Col ACol B
Apple864
Carrot189
Pear256
Apple975
Pear873
Carrot495
Apple95
Pear36
Carrot804

My objective is to have a unique list of food (from Col A), that returns the max corresponding Value from Col B. The formula for unique list from Col A is easy... =UNIQUE(filter(A:A,A:A<>"")), what I'm struggling with is getting a dynamic maxifs to align with this.

To illustrate, if I put the unique function in cell D2 (thus it would spill to d4 as shown below in blue), a correct corresponding non-array function would be =MAXIFS(B:B,A:A,D2) (shown in column e). I could drag this down the remaining rows but I would like this to be dynamic as there may be more food in my data set in the future.

What I would EXPECT to work is... =filter(MAXIFS(B:B,A:A,D2:D),D2:D<>"") but this returns #Value!. By comparison, if I were to use sumif/Average, =filter(SUMIF(A:A,D2:D,B:B),D2:D<>""), I get what I WOULD expect (which really confuses me).

Is there a way to get a dynamic maxifs (or any function that produces an equal value in column E) that would spill based on unique values in column D?

My data

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

小猫一只 2025-02-02 15:01:20

尝试:

=QUERY({A:B}, "select Col1,max(Col2) where Col2 is not null group by Col1 label max(Col2)''")


奖励:

=QUERY({A:B}, "select Col1,max(Col2),sum(Col2) where Col2 is not null group by Col1 label max(Col2)'',sum(Col2)''")


=SORTN(SORT(A1:B, 2, ), 9^9, 2, 1, 1)

​img src =“ https://i.sstatic.net/mfltn.png” alt =“在此处输入图像说明”>

2       - sort the second column of range A1:B
<empty> - or 0 or FALSE = "in descending order"
9^9     - output all rows
2       - 2nd mode of SORTN = "group by..."
1       - 1st column
1       - in ascending order

try:

=QUERY({A:B}, "select Col1,max(Col2) where Col2 is not null group by Col1 label max(Col2)''")

enter image description here


bonus:

=QUERY({A:B}, "select Col1,max(Col2),sum(Col2) where Col2 is not null group by Col1 label max(Col2)'',sum(Col2)''")

enter image description here


bonus 2:

=SORTN(SORT(A1:B, 2, ), 9^9, 2, 1, 1)

enter image description here

2       - sort the second column of range A1:B
<empty> - or 0 or FALSE = "in descending order"
9^9     - output all rows
2       - 2nd mode of SORTN = "group by..."
1       - 1st column
1       - in ascending order
情绪操控生活 2025-02-02 15:01:20

响应以提供更清晰的答案和简化,因为其他人看到的是相同的:

实现此目的的最简单方法是使用阵列公式,例如:
= max(如果($ a $ 1:$ a $ 7 =“苹果”,$ b $ 1:$ b%7))随后ctrl-shift-enter

Responding to provide a more clear answer and simplification as others see this looking for same:

The easiest way to accomplish this is by using an array formula such as:
=MAX(IF($A$1:$A$7="Apple",$B$1:$B%7)) followed by CTRL-SHIFT-ENTER

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文