Lookup for top value in each column and output row name

raikks

New Member
Joined
Feb 23, 2020
Messages
29
Office Version
  1. 2019
Platform
  1. Windows
colAcolB
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)
 

Some videos you may like

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
Joined
Oct 27, 2018
Messages
147
Office Version
  1. 365
Platform
  1. Windows
Please try

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
Joined
Feb 23, 2020
Messages
29
Office Version
  1. 2019
Platform
  1. Windows
Thanks for your reply.
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
Joined
May 28, 2005
Messages
48,400
Office Version
  1. 365
Platform
  1. Windows
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
Joined
Feb 23, 2020
Messages
29
Office Version
  1. 2019
Platform
  1. Windows

ADVERTISEMENT

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
Joined
Oct 27, 2018
Messages
147
Office Version
  1. 365
Platform
  1. Windows
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
Joined
Oct 25, 2016
Messages
88
Office Version
  1. 2019
Platform
  1. Windows

ADVERTISEMENT

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
Joined
Feb 23, 2020
Messages
29
Office Version
  1. 2019
Platform
  1. Windows
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
Joined
Feb 23, 2020
Messages
29
Office Version
  1. 2019
Platform
  1. Windows
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
Joined
May 28, 2005
Messages
48,400
Office Version
  1. 365
Platform
  1. Windows
i forgot to try the CTRL+SHIFT+ENTER
Sorry, I forgot to mention that for your version as it is not required in mine. :oops:
Thanks Bo-Ry and VBasic2008 for pointing that out. (y)
 

Watch MrExcel Video

Forum statistics

Threads
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.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

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

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

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
Top