Replicate one list against each value in another list - VBA?

Khristopher

New Member
Joined
Nov 1, 2013
Messages
2
Hi All,

This is my first post here so looking for a point in the right direction more than anything, I've done a lot of Google searching and forum searching but think the way I'm phrasing this question isn't coming up with the results i need.

I want to replicate every cell in one column against each cell in another list.

For example,

Column A contains numerical characters 1,2,3,4,5
Column B contains characters a,b,c,d,e

I want a new sheet to then contain:

[TABLE="width: 500"]
<tbody>[TR]
[TD]1[/TD]
[TD]a[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]b[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]c[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]d[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]e[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]a[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]b[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]c[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]d[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]e[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]a[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]b[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]c[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]d[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]e[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]a[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]b[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]c[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]d[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]e[/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]a[/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]b[/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]c[/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]d[/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]e[/TD]
[/TR]
</tbody>[/TABLE]

I'm doing this manually at the moment which is taking far too much time to populate data tables,

Any help is appreciated,

Thanks,
Khris
 
Hi,

Assuming the 5 rows of data you give are in Sheet1A1:B5, enter this formula in Sheet2A1 and copy down:

=INDEX(Sheet1!$A$1:$A$5,ROUNDUP(ROWS($1:1)/5,0))

And this one in Sheet2B1 and copy down:

=INDEX(Sheet1!$B$1:$B$5,IFERROR(1/(1/(MOD(ROWS($1:1),5))),5))

(Note: you don't give your Excel version - the second formula assumes you are using 2007 or later.)

Regards
 
Upvote 0
Hi,

Thankyou for that - Have got it to do exactly what was required. Added in some named ranges using offset formulas and a COUNTA so that if a longer list is used the formula wont need updating.

Thanks,
Khris
 
Upvote 0

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