Excel:写连接到特定值的列和行名称?

我一直在试图为下一个问题写一个公式,但我从来没有把它正确的。 所以:

我必须find二维数组中的前n个值,并记下连接到该值的行名和列名(没有重复!)。 举个例子,这是一个数组:

ABCDEF 1 Aron Jamie Matt Taylor Zedd 2 Aron - 5 7 6 8 3 Jamie 5 - 2 4 3 4 Matt 7 2 - 15 12 5 Taylor 6 4 15 - 26 6 Zedd 8 3 12 26 - 

什么应该由公式写下来,在这个例子中Top 3值和与这些值相关的名字:

 ABC Taylor Zedd 26 Taylor Matt 15 Matt Zedd 12 

谢谢!

用你的数据,运行这个macros:

 Sub dural() Dim i As Long, j As Long, K As Long i = 3: j = 2: K = 1 Do Cells(K, "G") = Cells(i, 1) Cells(K, "H") = Cells(1, j) Cells(K, "I") = Cells(i, j) K = K + 1 j = j + 1 If Cells(i, j).Value = "-" Then j = 2 i = i + 1 If i = 7 Then Exit Do End If Loop Range("G1:I10").Select ActiveWorkbook.Worksheets("Sheet1").Sort.SortFields.Clear ActiveWorkbook.Worksheets("Sheet1").Sort.SortFields.Add Key:=Range("I1:I10") _ , SortOn:=xlSortOnValues, Order:=xlDescending, DataOption:=xlSortNormal With ActiveWorkbook.Worksheets("Sheet1").Sort .SetRange Range("G1:I10") .Header = xlNo .MatchCase = False .Orientation = xlTopToBottom .SortMethod = xlPinYin .Apply End With End Sub 

会在GHI列中得到完整的结果。

select前三排来获得前三名的结果:

在这里输入图像说明

删除重复项,然后你可以使用Large()来计算出这样的三个最大的数字:

 =LARGE($B$2:$F$6,ROW(A1)) 

复制下来。 在C列的前3列中,可以使用这两个数组公式:

 =INDEX($A$1:$A$6,MIN(IF($B$2:$F$6=C10,ROW($B$2:$F$6)))) =INDEX($A$1:$F$1,MIN(IF($B$2:$F$6=C10,COLUMN($B$2:$F$6)))) 

CtrlShiftEnter确认

在这里输入图像说明