Results 1 to 6 of 6

Excel formula to move different column data into rows

This is a discussion on Excel formula to move different column data into rows within the Excel Questions forums, part of the Question Forums category; Hi There, We have an Excel list with data row and column wise like: Column A . . . Column ...

  1. #1
    New Member
    Join Date
    Apr 2007
    Posts
    15

    Default Excel formula to move different column data into rows

    Hi There,

    We have an Excel list with data row and column wise like:
    Column A . . . Column B . . . . . Column C
    Code1. . . . . .Text1_C1 . . . . . . Adon1_C1
    . . . . . . . . . . . . . . . . . . . . . . .Adon2_C1
    Code2 . . . . . .Text1_C2 . . . . . .Adon1_C2
    . . . . . . . . . . Text2_C2 . . . . . .Adon2_C2
    . . . . . . . . . . Text3_C2

    We want to transpose this into the following:
    Column A . . . . . Column B
    Code1 . . . . . . . . List:
    . . . . . . . . . . . . Text1_C1
    . . . . . . . . . . . . Documentation:
    . . . . . . . . . . . . Adon1_C1
    . . . . . . . . . . . . Adon2_C1
    Code2 . . . . . . . . List:
    . . . . . . . . . . . . Text1_C2
    . . . . . . . . . . . . Text2_C2
    . . . . . . . . . . . . Text3_C2
    . . . . . . . . . . . . Documentation:
    . . . . . . . . . . . . Adon1_C2
    . . . . . . . . . . . . Adon2_C2

    Is there a formula that can achieve this. If there is data in column B, then it must start with "List" in the new situation. Same as for column C, we want to start with "Documentation".

    We have a big list and we do not know for column B and C how many entries there are, there could be none, 1, 2 or even more entries.

    Thanks for any help, effort,
    Bastiaan

  2. #2
    Board Regular
    Join Date
    Mar 2012
    Posts
    934

    Default Re: Excel formula to move different column data into rows

    As far as a formula, there might be a way... but, it would be way complex. VBA would be a viable solution.

    Or, if you're interested, I can offer you a few steps to get the data in the way you mention. Just know, it would be a multiple step process. Let me know if you'd like the steps or if you'd rather hold out and see if someone posts some VBA for you.

  3. #3
    New Member
    Join Date
    Apr 2007
    Posts
    15

    Default Re: Excel formula to move different column data into rows

    Quote Originally Posted by pplstuff View Post
    As far as a formula, there might be a way... but, it would be way complex. VBA would be a viable solution.

    Or, if you're interested, I can offer you a few steps to get the data in the way you mention. Just know, it would be a multiple step process. Let me know if you'd like the steps or if you'd rather hold out and see if someone posts some VBA for you.
    He there,
    Thanks for your reply.
    As I don't know VBA, the steps are fine for me.

    Cheers,
    Bastiaan

  4. #4
    Board Regular
    Join Date
    Mar 2012
    Posts
    934

    Default Re: Excel formula to move different column data into rows

    Ok. Give me a few minutes to think it through and I'll reply again shortly.

  5. #5
    Board Regular
    Join Date
    Mar 2012
    Posts
    934

    Default Re: Excel formula to move different column data into rows

    1. In ColA, Select the entire range of rows that your data occupies. Hit "find & select" -"Go to special" in the ribbon, and select blanks.
    2. With the blanks highlighted, hit "=" and the the up arrow, then hit ctrl+enter. (At this point, your data should say Code1, Code1, Code2,Code2,Code2...)
    3. In D1, enter 1. in D2, enter "=if(a2=a1,d1+1,1)" <---drag this down all the rows, so you should end up with a counter for each code.
    4. In E1, enter =a1&"|"&d1&"|A|"&b1 <--drop down, so it would read "Code1|A|1|Text1_C1
    5. In E1, enter =a1&"|"&d1&"|B|"&c1 <--drop down, so it would read "Code1|B|1|Adon1_C1
    6. Copy ColE and past special, values into a new range. Do the same for ColF, but paste it directly under the ColE range. (so you should have one long list)
    7. Put a filter on that row and sort alphabetically.
    8. From here you can use Text-to-columns on the data tab with pipe ( | ) as the deliminator.

    This method will put everything in the order you requested, but it won't say "list:" or "Documentation:" before each section of Code. However, you can use find & replace (ctrl+f) to replace "a" with "list" and "b" with "documentation".

    Also, you can do the same numbering trick with if() statements to add in List and Documentation if you really need. Hope this helps and you can follow!

    Just remember, all you're doing if you follow these steps is creating a numbering system that will sort alphabetically.

  6. #6
    New Member
    Join Date
    Apr 2007
    Posts
    15

    Default Re: Excel formula to move different column data into rows

    Thanks for the answer, I have tried it and it works
    I only need to figure out how to add the "List" and "Documentation".
    Maybe I will post another message for this.

    Thanks for your help

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


DMCA.com