gpt4 book ai didi

excel - 向下查找未排序的列表以查找大于或等于的值

转载 作者:行者123 更新时间:2023-12-04 21:19:51 30 4
gpt4 key购买 nike

我在列 A 中有一个未排序数量的列表以及它们在 B 列中的对应值.

我需要一个非数组 Excel 公式,它返回第一个值 greater than or equals to输入数量。

例如:
Minimum Qty: 6
场景一:

enter image description here
Output Value: B
场景二:

enter image description here
Output Value: B
场景 3:

enter image description here
Output Value: B
场景四:

enter image description here
Output Value: Nil
到目前为止,我已经尝试了 Index/Match公式,但只有 small than or equal to似乎工作。 greater than or equals to似乎不适用于未排序的列表。

enter image description here

最佳答案

也许使用 INDEX , AGGREGATE , ROWIFERROR :

=IFERROR(INDEX(B2:B4,AGGREGATE(15,6,ROW(A1:A3)/(A2:A4>=E3),1)),"Nil")

破解关键部分 AGGREGATE(15,6,ROW(A1:A3)/(A2:A4>=E3),1)下,使用场景 1:
  • ROW(A1:A3)/(A2:A4>=E3) : 这是{1;2;3}/{2;6;3}>=6 .
  • {2;6;3}>=6计算结果为 {FALSE;TRUE;FALSE} .
  • {1;2;3}/{FALSE;TRUE;FALSE}计算结果为 {#DIV/0!;2;#DIV/0!} .
  • AGGREGATE 的第一个参数 - 15 - 表示我们正在使用 SMALL功能。
  • AGGREGATE 的第二个参数 - 6 - 表示忽略错误。
  • AGGREGATE 的最后一个参数 - 1 - 对应于 k 的第二个 ( SMALL ) 参数,即 SMALL(array, k) .
  • 所以忽略错误,SMALL({#DIV/0!;2;#DIV/0!}, 1) = 2 .
  • 对于其他场景也是如此:
  • 场景二:SMALL({#DIV/0!;2;3}, 1) = 2 .
  • 场景三:SMALL({#DIV/0!;2;#DIV/0!}, 1) = 2 .
  • 场景四:SMALL({#DIV/0!;#DIV/0!;#DIV/0!}, 1)抛出 #NUM!错误,所以 IFERROR返回 Nil .

  • 场景一:

    enter image description here

    场景二:

    enter image description here

    场景三:

    enter image description here

    场景四:

    enter image description here

    关于excel - 向下查找未排序的列表以查找大于或等于的值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55644172/

    30 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com