# Lookup for top value in each column and output row name

#### raikks

##### New Member
 colA colB row1 3​ 7​ row2 5​ 4​ row3 12​ 7​

Lookup for the top value in each column. then output the row's name.

Ex.
* for colA -> output row3
* for colB -> output row1 & row3 (if possible)

### Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple

#### Bo_Ry

##### Board Regular

Book1
AB
137
254
3127
4
5Row3Row1, Row3
Sheet1
Cell Formulas
RangeFormula
A5:B5A5=TEXTJOIN(", ",,INDEX(REPT("Row"&ROW(A1:A3),A1:A3=MAX(A1:A3)),))

#### raikks

##### New Member
This partially solves my problem.
Maybe my example wasn't very clear because the row names are important - let me rename them:
* row1 - apples
* row2 - bananas
* row3 - oranges

I don't mind using an additional function to replace text.

#### Peter_SSs

##### MrExcel MVP, Moderator
Try this

20 10 11.xlsm
ABC
1apples37
2bananas54
3oranges127
4
5orangesapples, oranges
Textjoin
Cell Formulas
RangeFormula
B5:C5B5=TEXTJOIN(", ",1,IF(B1:B3=MAX(B1:B3),\$A1:\$A3,""))

#### raikks

##### New Member

Unfortunately, it doesn't work - copy pasted exactly the same example as above and the result is #VALUE!
I'm not sure why...

#### Bo_Ry

##### Board Regular
You need to confirm Peter_SSs's formula with Ctrl+Shift+Enter

or this with normal enter
Book1
ABC
1apples37
2bananas54
3oranges127
4
5orangesapples, oranges
Sheet1
Cell Formulas
RangeFormula
B5:C5B5=TEXTJOIN(", ",,INDEX(REPT(\$A1:\$A3,B1:B3=MAX(B1:B3)),))

#### VBasic2008

##### Board Regular

Unfortunately, it doesn't work - copy pasted exactly the same example as above and the result is #VALUE!
I'm not sure why...
Since you don't have Office 365, you have to enter the formula as an array formula, holding CTRL+SHIFT and pressing ENTER. The formula in the formula bar will then look like this:
`{=TEXTJOIN(", ",1,IF(B1:B3=MAX(B1:B3),\$A1:\$A3,""))} `

#### raikks

##### New Member
Since you don't have Office 365, you have to enter the formula as an array formula, holding CTRL+SHIFT and pressing ENTER. The formula in the formula bar will then look like this:
`{=TEXTJOIN(", ",1,IF(B1:B3=MAX(B1:B3),\$A1:\$A3,""))} `
Thanks, works fine now.

#### raikks

##### New Member
You need to confirm Peter_SSs's formula with Ctrl+Shift+Enter

or this with normal enter
Book1
ABC
1apples37
2bananas54
3oranges127
4
5orangesapples, oranges
Sheet1
Cell Formulas
RangeFormula
B5:C5B5=TEXTJOIN(", ",,INDEX(REPT(\$A1:\$A3,B1:B3=MAX(B1:B3)),))
Thank you, i forgot to try the CTRL+SHIFT+ENTER - it does work indeed.

#### Peter_SSs

##### MrExcel MVP, Moderator
i forgot to try the CTRL+SHIFT+ENTER
Sorry, I forgot to mention that for your version as it is not required in mine.
Thanks Bo-Ry and VBasic2008 for pointing that out.

Replies
12
Views
186
Replies
15
Views
241
Replies
15
Views
226
L
Replies
16
Views
508
Replies
1
Views
74

1,127,620
Messages
5,625,912
Members
416,142
Latest member
IODIEN

### We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.

### Which adblocker are you using?

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

### Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

### Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back