简体   繁体   English

返回由索引和匹配查询确定的范围的第K个最大值

[英]Return Kth largest Value of range that is determined by an Index & Match lookup

My question is similar to one asked here , but I am having trouble making this work for my situation given my data. 我的问题类似于这里的问题 ,但根据我的数据,我无法根据自己的情况进行这项工作。 I have a data set that uses seeded numbers in row 1 that I use to index match columns. 我有一个数据集,该数据集使用第1行中的种子编号来索引匹配列。 This is because there are drop-down menus that change the match column based on user selection. 这是因为有些下拉菜单会根据用户选择更改匹配列。 So the the columns cannot be directly referenced. 因此,这些列不能直接引用。 My data very roughly looks like this: 我的数据大致如下所示:

         45      46      50     28  

Route   
CCS     500      325     40    200
CCS     370      100    380     10
RCS      90      825     50    999
CCS     100       50     32    358

So when my user makes a selection, the number in AE2 changes to reflect the column seed I want (in example, either 45, 46, 50, or 28). 因此,当我的用户进行选择时,AE2中的数字会更改以反映我想要的列种子(例如45、46、50或28)。 I want to be able to return the Kth largest number in that column that is also "CCS". 我希望能够在该列中也返回第K个最大数字,即“ CCS”。 So lets say the user chooses 46 and I want the 2nd largest number that has "CCS" in Route. 因此,可以说用户选择46,而我想要Route中具有“ CCS”的第二大数字。 So the formula searches row 1 for "46", then once it finds the column with it, it looks down that column for the 2nd largest CCS value -- which is 100. I have tried to modify the formula suggested in the other question, (below) but that just seems to stop at the first observation, and I need it to search all of the observations. 因此,公式在第1行中搜索“ 46”,然后找到该列,然后在该列中向下查找第二个最大CCS值-即100。我试图修改另一个问题中建议的公式, (下图),但这似乎只是在第一次观察时就停止了,我需要它来搜索所有观察值。

LARGE(IF( 'Program Data'!O:O="CCS", INDEX('Program Data'!$A:$GB,0,(MATCH($AE$2,'Program Data'!$1:$1,0)))),1)

Any tips as to what I'm doing wrong? 关于我在做什么错的任何提示吗?

您的公式对我有用。...但这是一个“数组公式”,因此您需要按CTRL + SHIFT + ENTER进行确认,以便在公式周围出现{和}之类的花括号

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM