Excel 中的 INDEX 公式,前 10 个,重复以前的值

INDEX formula in Excel, Top 10, repeats previous value

我正在查看 table 中前 10 个值的数据。我正在用公式来做:

=LARGE($R:$R,U13)

这个公式在V栏中。

这些值是从这个 table:

接管的

W 列中,我试图确定哪个国家/地区具有前 10 个值之一。我正在用公式来做:

=INDEX($I:$I,MATCH(V13,$R:$R,0))

我的问题如下。如果 2 个国家/地区的前 10 个值相同(如我 table 底部的案例 9 和 10,其中 2 个国家/地区的值为 39),我的 INDEX 公式重复找到的第一个国家/地区在两行中。

例如,排名 10 的应该是尼日利亚,因为它的值也是 39。

我想,我做错了什么,是吗?

在单元格 W4 中试试这个公式:

=IF(V3=V4,INDEX(INDIRECT("I"&MATCH(W3,I:I,0)+1&":I26"),MATCH(V4,INDIRECT("R"&MATCH(W3,I:I,0)+1&":R26"),0)),INDEX($I:$I,MATCH(V4,$R:$R,0)))

该公式检查前一个国家/地区的分数是否与实际国家/地区相同。在这种情况下,它会搜索列表中的前一个国家并重新定义搜索分数的范围。这样,即使整个列表中的完美关系也会产生一个独特国家的列表。

您的公式没有解决您的问题,因为 INDEX 函数搜索第一次出现的搜索值。它不考虑在另一个单元格中您是否已经 运行 另一个索引。通过根据先前的结果重新定义要搜索的范围,您将只删除您正在搜索的值的第一次(或第二次、第三次或其他)出现(以及您不关心的其他一些值)。

分解公式我们得到:

=IF(V3=V4,                                    'Checks for a tie
    '---------------------------------------------If it's a tie
    INDEX(                                       'Use a index function to pick the result
          INDIRECT(                                 'Use an indirect function to define the range to be searched
                   "I"&                                'State the column of the range to be searched
                   MATCH(W3,I:I,0)+1&                  'Use a match function to find the previous occurence of the score whithin the column of the range to be searched and add 1 to it to cut out that value (and any previous one)
                   ":I26"                              'State the closing cell of the range to be searched
                  ),
          MATCH(                                    'Use a match function to determine in what row of the defined range the score is occuring
                V4,                                    'The value to be searched
                INDIRECT(                              'Use an indirect function to define the range to be searched
                         "R"&                             'State the column of the range to be searched
                         MATCH(W3,I:I,0)+1&               'Use a match function to find the previous occurence of the score whithin the column of the range to be searched and add 1 to it to cut out that value (and any previous one)
                         ":R26"                           'State the closing cell of the range to be searched
                        ),
                0                                         'Specify that you want the the exact occurence
               )
         ),
    '---------------------------------------------If it's not a tie
    INDEX(                                       'Use a index function to pick the result
          $I:$I,                               'State the range to be searched
          MATCH(                                    'Use a match function to determine in what row of the range the score is occuring
                V4,                                    'The value to be searched
                $R:$R,                            'State the range to be searched
                0                                      'Specify that you want the the exact occurence
               )
         )

   )