-5

I have a Excel sheet that contains hundreds of data like this:

Name 1  Name 2  Name 3  Name 4

   A      Aa      Aaa   Aaa


Name 5  Name 6  Name 7  Name 8

   B     Bb      Bbb    Bbbb

I need to put them like this, all at once:

Name 1      A
Name 2      Aa
Name 3      Aaa
Name 4      Aaa

Name 5      B
Name 6      Bb
Name 7      Bbb
Name 8      Bbbb

How can I do it? Any macro method?

3
  • 1
    "Any macro method?", yes, but we're not a script writing service. What have you tried already? Where exactly are you getting stuck writing your macro script? Aug 18, 2014 at 18:31
  • I'd suggest looking at Paste Special -> Transpose, and then record a macro around that, iterating over every two rows . . .
    – ernie
    Aug 18, 2014 at 18:32
  • I have hundred of double rows above I mentioned..It is not practical to do for every 2 rows..I need at one shot methode Aug 18, 2014 at 18:44

1 Answer 1

2

I would resolve this with the Power Query Add-In. It takes a few steps to get there but no Macro code or changes to your input data structure are required.

I've built a prototype which you can view or download - its "Power Query demo - Unpivoting pairs of rows into two columns.xlsx" in my One Drive:

https://onedrive.live.com/redir?resid=4FA287BBC10EC562%21398

Basically my technique was to first build an intermediate query which filters down to every odd-numbered row, and adds an "Index Row Pairs" column to keep track of the row pairs. Then I created duplicate of that Query, which filters down to the even-numbered rows. Then I used a Merge to join (on the "Index Row Pairs" column) to the first Query and get the Odd and Even row columns all in a single row. Then I added a pair of Unpivots to transform the 4 Odd row columns and the 4 even row columns into 8 rows. Then I added a calculation to filter down to the required set of rows.

4
  • Hii,I am using excel 2007..Can I used this for 2007? Aug 19, 2014 at 7:08
  • No it needs Excel 2010 +. There is a lot of other data and analysis improvements in Excel 2013 - it should be an easy decision to upgrade after 7+ years.
    – Mike Honey
    Aug 19, 2014 at 23:30
  • Hii,I installed office 2013..But I am difficult to do.Could you explain step by step..Please.. Aug 20, 2014 at 14:03
  • That's good to hear (Office 2013). But gee I've already built a working prototype. I think you need to put in some effort to learn Power Query. There are lots of good videos and blog posts out there, plus you can follow the steps my demo for this challenge. I have other working demos in the same Onedrive folder. If you do need direct mentoring, I charge by the hour.
    – Mike Honey
    Aug 21, 2014 at 0:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .