+ Reply to Thread
Results 1 to 10 of 10

How to move data in columns below another set of columns

  1. #1
    Registered User
    Join Date
    03-28-2012
    Location
    India
    MS-Off Ver
    Excel 2016
    Posts
    38

    Question How to move data in columns below another set of columns

    I have data in multiple rows below 9 columns, something like this:
    ABCDEFGHI
    111222333
    111222333

    I want the data below the columns DEF and GHI below ABC, so that they look like this:
    ABC
    111
    111
    222
    222
    333

    I tried to copy and paste the data below DEF and GHI below ABC, but I get this message "You can't paste this here because the copy area and paste area aren't the same size".

    Basically, I have to select the 'paste area' before pasting, so that the copied cells fit into it exactly.

    Since the data is enormous, it is tedious to do it manually.

    I just wish to ask the experienced people over here if there is a simpler way of getting this done?

    Thank you!

  2. #2
    Forum Expert JLGWhiz's Avatar
    Join Date
    02-20-2011
    Location
    Florida, USA
    MS-Off Ver
    Windows 10, Excel 2013
    Posts
    2,070

    Re: How to move data in columns below another set of columns

    Please Login or Register  to view this content.
    You cannot copy the entire column and then paste it to a smaller number of rows. Only copy or cut the rows with data.

  3. #3
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,063

    Re: How to move data in columns below another set of columns

    Or using a formula:

    =OFFSET($A$2,INT((ROWS($1:1)-1)/3),3*(MOD((ROWS($1:1)-1),3))+MOD((COLUMNS($A:A)-1),3),,)
    Attached Files Attached Files
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  4. #4
    Registered User
    Join Date
    03-28-2012
    Location
    India
    MS-Off Ver
    Excel 2016
    Posts
    38

    Re: How to move data in columns below another set of columns

    Thank you JLGWhiz and Glenn Kennedy for your time and valuable suggestions!

    Both of your solutions work perfectly!

    For the table given below:
    Col 1 Col 2 Col 3 Col 4 Col 5 Col 6 Col 7 Col 8 Col 9
    1 2 3 4 5 6 7 8 9
    11 12 13 14 15 16 17 18 19
    21 22 23 24 25 26 27 28 29

    Result with JLGWhiz's code:
    Col 1 Col 2 Col 3
    1 2 3
    11 12 13
    21 22 23
    Col 4 Col 5 Col 6
    4 5 6
    14 15 16
    24 25 26
    Col 7 Col 8 Col 9
    7 8 9
    17 18 19
    27 28 29

    Result with Glenn Kennedy's formula:
    Col 1 Col 2 Col 3
    1 2 3
    4 5 6
    7 8 9
    11 12 13
    14 15 16
    17 18 19
    21 22 23
    24 25 26
    27 28 29

    However, since I am not well acquainted with excel functions or VBA, I am not able to modify them to exactly suit my actual needs. I had in fact given a simple example to quickly explain my situation.

    I had tried tweaking the provided solutions, and also tried searching the internet, but was not completely successful.

    I would be much thankful if you could help me out with the following:

    1) What if the number of columns needed were more than 3? (e.g. ABCD instead of ABC).
    I was able to successfully tweak JLGWhiz's code to suit my needs, as I had to just change the range of cells which needs to be cut and pasted.
    However, to me the formula by Glenn Kennedy was more difficult to crack.

    2) What if the first column is specific to each row and has to be retained along with the contents of the row?

    Example:
    NAME Col 1 Col 2 Col 3 Col 4 Col 5 Col 6 Col 7 Col 8 Col 9
    AAA 1 2 3 4 5 6 7 8 9
    BBB 11 12 13 14 15 16 17 18 19
    CCC 21 22 23 24 25 26 27 28 29

    Needed result:
    NAME Col 1 Col 2 Col 3
    AAA 1 2 3
    AAA 4 5 6
    AAA 7 8 9
    BBB 11 12 13
    BBB 14 15 16
    BBB 17 18 19
    CCC 21 22 23
    CCC 24 25 26
    CCC 27 28 29

    For this second issue, I was able to modify neither of the provided solutions.

    Once again I thank you both for your generous help!

  5. #5
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,063

    Re: How to move data in columns below another set of columns

    Apologies for misreading your request. the attached sheet shows the original incorrect answer, what it should have been and the formulae for the two new variants requested.
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    03-28-2012
    Location
    India
    MS-Off Ver
    Excel 2016
    Posts
    38

    Re: How to move data in columns below another set of columns

    That was perfect!

    Glenn Kennedy you are awesome!

    Thanks a ton!

  7. #7
    Registered User
    Join Date
    05-04-2020
    Location
    united states
    MS-Off Ver
    office 2007
    Posts
    6

    Re: How to move data in columns below another set of columns

    Hello... I have a similar problem.. In my case, I have set of numbers (hundreds of them) separated by two empty rows..
    I want to merge them based on each set.

    for instance, for the below table,
    col1 col2 col3 col4 col5 col6
    1 2 3 4 5 6
    11 12 13 14 15 16
    21 22 23 24 25 26
    31 32 33 34 35 36


    col7 col8 col9 col10 colx coly
    7 8 9 10 x1 y1
    17 18 19 20 x2 y2
    27 28 29 30 x3 y3
    37 38 39 40 x4 y4


    result must be

    col1 col2 col3
    1 2 3
    11 12 13
    21 22 23
    31 32 33
    col4 col5 col6
    4 5 6
    14 15 16
    24 25 26
    34 35 36


    col7 col8 col9
    7 8 9
    17 18 19
    27 28 29
    37 38 39
    col10 colx coly
    10 x1 y1
    20 x2 y2
    30 x3 y3
    40 x4 y4

  8. #8
    Registered User
    Join Date
    05-04-2020
    Location
    united states
    MS-Off Ver
    office 2007
    Posts
    6

    Re: How to move data in columns below another set of columns

    Hello... I have a similar problem.. In my case, I have set of numbers (hundreds of them) separated by two empty rows.. each must be considered as a set.

    I want to merge the columns as rows based on each set.

    for instance, for the below table,
    col1 col2 col3 col4 col5 col6
    1 2 3 4 5 6
    11 12 13 14 15 16
    21 22 23 24 25 26
    31 32 33 34 35 36


    col7 col8 col9 col10 colx coly
    7 8 9 10 x1 y1
    17 18 19 20 x2 y2
    27 28 29 30 x3 y3
    37 38 39 40 x4 y4


    result must be

    col1 col2 col3
    1 2 3
    11 12 13
    21 22 23
    31 32 33
    col4 col5 col6
    4 5 6
    14 15 16
    24 25 26
    34 35 36


    col7 col8 col9
    7 8 9
    17 18 19
    27 28 29
    37 38 39
    col10 colx coly
    10 x1 y1
    20 x2 y2
    30 x3 y3
    40 x4 y4

    If this is not clear, I have attached a table with two example sets and expected results.
    Please help.
    Attached Files Attached Files

  9. #9
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,938

    Re: How to move data in columns below another set of columns

    pavithrakb Administrative Note:

    Welcome to the forum.

    We are happy to help, however whilst you feel your request is similar to this thread, experience has shown that things soon get confusing when answers refer to particular cells/ranges/sheets which are unique to your post and not relevant to the original.

    Please see Forum Rule #4 about hijacking and start a new thread for your query.

    If you are not familiar with how to start a new thread see the FAQ: How to start a new thread
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  10. #10
    Registered User
    Join Date
    05-04-2020
    Location
    united states
    MS-Off Ver
    office 2007
    Posts
    6

    Re: How to move data in columns below another set of columns

    Hello Ford, Thanks for the clarification.

    I have submitted my query as a new thread.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 0
    Last Post: 10-04-2017, 12:53 PM
  2. Replies: 12
    Last Post: 03-14-2016, 08:42 AM
  3. combine columns with text, move over columns with number
    By ammartino44 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 06-30-2015, 02:58 PM
  4. [SOLVED] Move data in two columns
    By YasserKhalil in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-13-2015, 06:35 PM
  5. Replies: 1
    Last Post: 12-18-2013, 05:31 PM
  6. Replies: 5
    Last Post: 12-06-2011, 09:23 AM
  7. Macro required to move Columns and addidng columns with headings
    By sponge_designs in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-03-2009, 08:20 PM

Tags for this Thread

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1