将下一个匹配项返回到列中的相等值 [英] Returning next match to a equal value in a column

查看:23
本文介绍了将下一个匹配项返回到列中的相等值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我经常需要搜索列以找到值的匹配项,然后返回相应的值.我的问题是 INDEXMATCH 总是返回列中的第一个值.

I often need to search through columns to find the match to values and then return the according value. My issue is that INDEXand MATCHalways return the first value in the column.

前.我有 7 个汽车经销商,这是上个月的销售额.奥斯陆和柏林出售的数量相同,C 列中的 INDEX(D:E,MATCH(B1,E:E,0),1)) 将返回第一个命中来自 D 列.

EX. I got 7 car dealers and this is the sales last month. Oslo and Berlin sold the same ammount and INDEX(D:E,MATCH(B1,E:E,0),1)) in column C will return the first hit from column D.

A       B      C                   D         E
rank  Sales  Delaer
1     409    London         |     Tokyo     272
2     272    Tokyo          |     London    409
3     257    Hawaii         |     oslo      248
4     255    Stockholm      |     numbai    240
5     248    Oslo           |     Berlin    248
6     248    Oslo           |     hawaii    257 
7     240    Numbai         |     Stockholm 255

目前我最好的解决方案是首先找到 B 中的每个值在 E 中得到的行 MATCH(B1,E:E,0) 并将其添加到新列(column F).然后我可以在下一列中添加另一个公式,这就是我目前必须做的:=IF(F2=F1;MATCH(F2;INDIRECT("F"&(1+F1)):$F$7;0))+F2

At the moment my best solution is to first find the row each value in B got in E with MATCH(B1,E:E,0) and add that to a new column (column F). Then I can add another formula in the next column, which is what I currently have to do: =IF(F2=F1;MATCH(F2;INDIRECT("F"&(1+F1)):$F$7;0))+F2

在这方面有更好的方法吗?

Is there a better approach at this?

推荐答案

在 B2 中使用以下标准公式,

In B2 use the following standard formula,

=IFERROR(LARGE(E$2:E$8, ROW(1:1)), "")

根据需要填写.

在 C2 中使用以下标准公式,

In C2 use the following standard formula,

=INDEX(D$2:D$8, AGGREGATE(15, 6, ROW($1:$7)/(E$2:E$8=B2), COUNTIF(B$2:B2, B2)))

根据需要填写.

[可选] - 修复 A 列中的排名.

[Optional] - Repair the ranking in column A.

在 A2 中使用以下公式,

In A2 use the following formula,

=SUMPRODUCT((B$2:B$8>=B2)/(COUNTIFS(B$2:B$8, B$2:B$8&"")))

根据需要填写.

这篇关于将下一个匹配项返回到列中的相等值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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