Ok, so I have data that looks like this (spaces being column breaks):
FirmA FirmB FirmC FirmD
FirmE FirmF
FirmG FirmH FirmI
FirmJ FirmK FirmL FirmM FirmN
etc.
And I need it to look like this:
FirmA FirmB
FirmA FirmC
FirmA FirmD
FirmE FirmF
FirmG FirmH
FirmG FirmI
FirmJ FirmK
FirmJ FirmL
FirmJ FirmM
FirmJ FirmN
etc.
Basically in a row where there's just a pair, it leaves it alone. In a row with more than a pair (3 or more columns), it makes a row for each pair with the first firm in the original row always the first column, and subsequent firms as the second.
I also need all this another way, too. Back to the example (simplified, don't want it as long):
FirmA FirmB FirmC FirmD
FirmE FirmF
FirmG FirmH FirmI
etc.
I also need a separate version (i.e. another macro) to make it look like this:
FirmA FirmB
FirmA FirmC
FirmA FirmD
FirmB FirmC
FirmB FirmD
FirmC FirmD
FirmE FirmF
FirmG FirmH
FirmG FirmI
FirmH FirmI
etc.
(Essentially just converting every row into all possible pairs).
I'm sure there's a fairly straightforward approach here but I'm terrible at programming Excel... any help? I'd obviously like it as a macro if possible. It'd be hugely appreciated. I'm using a dataset with something like 8 thousand rows (and need to do it 5 different times), so you can see why I'd like this automated.
Thanks so much!
--Craig
Bookmarks