Excel中的INDEX公式,前10名,重复上一个值

问题描述

我正在浏览一个包含前10个值的数据的表。我正在用公式:

=LARGE($R$2:$R$26,U13)

此公式在V列中。

enter image description here

该值取自该表:

enter image description here

W列中,我试图确定哪个国家的前十个值之一正确。我正在用公式:

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

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

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

我认为,我做错了,是吗?

解决方法

在W4单元格中尝试以下公式:

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

该公式检查前一个国家的分数是否与实际国家相同。在这种情况下,它将搜索列表中的前一个国家,然后重新定义要为分数保留的范围。这样,即使是整个清单中的完美领带,也会产生一个独特的国家/地区清单。

您的公式无法解决您的问题,因为INDEX函数搜索搜索到的值的第一个匹配项。它不会考虑您是否在另一个单元格中已经运行了另一个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,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,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$2:$I$26,'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$2:$R$26,'State the range to be searched
                0                                      'Specify that you want the the exact occurence
               )
         )

   )