查找数组中的前3个项目,如果出现平局,则优先考虑列表中较高的项目 [英] Find the top 3 items in an array, with priority given to those higher on a list in the event of tie

查看:47
本文介绍了查找数组中的前3个项目,如果出现平局,则优先考虑列表中较高的项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的列表中只有数字,每行中的每个乐谱都有一个对应的名称.我正在寻找一个公式来绘制具有相应等级的第一,第二和第三名称.但是,如果是平局,我还是想画最大的数字,并优先选择列表中较高的名称.

My list has only numbers, with a corresponding name to each score in each row. I am looking for a formula to draw lookup the 1st, 2nd and 3rd names with the corresponding rank. However, in the event of ties, i would like still like to draw the largest number, with preference for names higher on the list.

推荐答案

在单元格E1中插入以下公式,然后向下复制.

In cell E1 insert following formula and then copy down.

= IFERROR(INDEX($ A $ 1:$ A $ 15,SMALL(IF($ B $ 1:$ B $ 15 = MAX($ B $ 1:$ B $ 15),ROW($ A $ 1:$ A)$ 15),10 ^ 7),ROWS($ A $ 1:A1))),")

注意:这是数组公式,因此需要使用 CTRL + SHIFT + ENTER 来提交同时地.如果正确完成,Excel将用大括号括住公式.

Note: This is array formula so it needs to be committed by using CTRL+SHIFT+ENTER simultaneously. If done correctly Excel will wrap formula with braces.

这是一个基于非CSE AGGREGATE 的公式(基于@Naresh Bhople的建议)

Here's a non-CSE AGGREGATE based formula (based on @Naresh Bhople's suggestion)

= IFERROR(INDEX($ A $ 1:$ A $ 15,AGGREGATE(15,6,IF($ B $ 1:$ B $ 15 == MAX($ B $ 1:$ B $ 15),ROW($ A$ 1:$ A $ 15),10 ^ 7),ROWS($ A $ 1:A1))),")

如果条件已删除,则以下不是数组公式.引用了此链接

Following is not array formula after removing if condition. Referred this link

=IFERROR(INDEX($A$1:$A$15,AGGREGATE(15,6,(($B$1:$B$15=MAX($B$1:$B$15))/($B$1:$B$15=MAX($B$1:$B$15))*ROW($A$1:$A$15)),ROWS($A$1:A1))),"")

以下是一个笨拙的方法,但是它可以处理此数据并进行有限的测试,这是一个数组公式.

Following is an unwieldy approach but it works with this data and limited testing I did, it is an array formula.

= INDEX($ A $ 2:$ A $ 15,MATCH(SMALL(NPV(-RANK.EQ($ B $ 2:$ B $ 15,$ B $ 2:$ B $ 15)%,$ B $ 2:$ B $ 15)* 100 + ROW($ B $ 2:$ B $ 15),ROWS($ A $ 1:A1)),NPV(-RANK.EQ($ B $ 2:$ B $ 15,$ B $ 2:$ B $ 15))%,$ B $ 2:$ B $ 15)* 100 + ROW($ B $ 2:$ B $ 15),0))

这篇关于查找数组中的前3个项目,如果出现平局,则优先考虑列表中较高的项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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