Multiple rows Map to Multiple rows

Terry_Carter

New Member
Joined
Sep 9, 2019
Messages
2
Hi this is my first post, firat of all thank you to eveyone here this site is always a great source of infiormation and help. :)

Here is my problem
I have a list of People and a list of items, each item has to aligned to the person - Multiple persons - Unique Item

Thanks in advance Terry

List A

Person 1
Person 2

List B
Item 1
Item 2

Output
List c

Person 1 - Item 1
Person 1 - Item 2
Person 2 - Item 1
Person 2 - Item 2

etc



What I haveWhat I want
List A List BList C
PersonAccess neededPerson 1Access needed
Person 1Access onePerson 1Access one
Person 2Access sixPerson 1Access six
Person 3Access abcPerson 1Access abc
Person 4Access XYZPerson 1Access XYZ
Person 5Access 5
Person 6Access 15Person 2Access needed
Person 1000Person 2Access one
Person 2Access six
Person 2Access abc
Access XYZ
Person 3Access needed
Person 3Access one
Person 3Access six
Person 3Access abc
Person 3Access XYZ
Person 1000Access needed
Person 1001Access one
Person 1002Access six
Person 1003Access abc
Person 1004Access XYZ
Person 1005Access 5
Person 1006Access 15
Person 1007Access LAST

<colgroup><col><col><col><col><col><col></colgroup><tbody>
</tbody>


Thanks Terry
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
Hi & welcome to MrExcel
Do you want the output in two columns, or the two values concatenated in one column?
 
Upvote 0
Ok, how about
Code:
Sub TerryCarter()
   Dim Rng As Range, Cl As Range
   
   Set Rng = Range("B2", Range("B" & Rows.Count).End(xlUp))
   For Each Cl In Range("A2", Range("A" & Rows.Count).End(xlUp))
      With Range("C" & Rows.Count).End(xlUp).Offset(1).Resize(1 * Rng.Count)
         .Value = Cl.Value
         .Offset(, 1).Value = Rng.Value
      End With
   Next Cl
End Sub
This assumes the two lists are in col A & B starting in row 2 & will output into cols C & D
 
Upvote 0

Forum statistics

Threads
1,214,605
Messages
6,120,473
Members
448,967
Latest member
visheshkotha

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