hlookup all values by columns?

Twatwood

New Member
Joined
Nov 10, 2016
Messages
13
Office Version
  1. 365
Platform
  1. Windows
Similar to the vlookup solution that does rows, I am interested to lookup rows and display as columns. (all matches)

INPUT
StaffTypeStaffMember
ManagerJane
WorkerJohn
WorkerTom
Manager****
WorkerHarry
WorkerBob
WorkerJoe

<tbody>
</tbody>



DESIRED OUTPUT

Member1Member2Member3Member4Member5
Manager****Jane
WorkerBobHarryJoeJohnTom

<tbody>
</tbody>
Note the input is unsorted and the output is sorted


I played with the vlookup and rows/index match solutions for a bit, but couldn't work out how to transpose the output or sort it.
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
Can you use something like this? I replicated your input (A1:B8) and desired output (A10:F12). I put the formula in A11:
=IFERROR(INDEX($A$2:$A$8,SMALL(IF(FREQUENCY(IF($A$2:$A$8<>"",MATCH($A$2:$A$8,$A$2:$A$8,0)),ROW($A$2:$A$8)-ROW($A$2)+1),ROW($A$2:$A$8)-ROW($A$2)+1),ROWS($A$11:A11)))," ") Use Cntrl+Shift+Enter copy down. You should get your answers Manager and Worker.

I put the other formula in B11:
=IFERROR(INDEX($B$2:$B$8,SMALL(IF($A$2:$A$8=$A$11,ROW($B$2:$B$8)-ROW($B$2)+1),COLUMNS($B$11:B11)))," ") copy across. Then tweak your formula to look for Worker. I enclosed =iferror(......," ") to remove error messages.

Member1Member2Member3Member4Member5
ManagerJane***
WorkerJohnTomHarryBobJoe

<colgroup><col><col><col span="4"></colgroup><tbody>
</tbody>



<tbody>
</tbody>

<tbody>
</tbody>

You would need to change in the f
 
Upvote 0
Hi, can you please brief about following part of formula as I have no idea about Row and column function

ROW($A$2:$A$8)-ROW($A$2)+1
 
Upvote 0
First of all, I am not an Mr Excel expert, but I will try my best to explain what is going on. The =row( function shows that range with numbers. For example, the row formula =row(B2:B8) will show up as 2 in your cell. The 2 shows is the first cell (B2) in the range. In actuality the formula consists of (2:3,4;5;6;7;8). You can see this when you highlight this formula and then press F9. For this formula to work, you want to have these numbers show as 1;2;3 etc. When you subtract the =row(first cell in range),your answer will be 0 (0;1;2;etc.). So that is why then you add that 1 to your formula to get (1;2;3;4, etc.). 1 is the first item in range, 2 the second item, etc. The columns formula simply shows numbers. For example =rows(B1:1b1)will show 1, then =rows(b1:b2) will show 2 as you copy down. This means it will produce the first, then second result. The columns formula works the same way when you want to show your answers copying across. Hope this helps
 
Upvote 0

Forum statistics

Threads
1,216,075
Messages
6,128,668
Members
449,463
Latest member
Jojomen56

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
Back
Top