+ Reply to Thread
Results 1 to 42 of 42

Copy a column in every nth row

  1. #1
    Forum Contributor
    Join Date
    08-31-2022
    Location
    Swiss
    MS-Off Ver
    365
    Posts
    134

    Copy a column in every nth row

    Dear members of the forum!

    Is there a command to copy each entry of a row into another row but leaving blacks in between?
    I made a screenshot to show how it should look like.

    Thank you in advance,

    David
    Attached Images Attached Images

  2. #2
    Forum Contributor
    Join Date
    08-31-2022
    Location
    Swiss
    MS-Off Ver
    365
    Posts
    134

    Re: Copy a column in every nth row

    I hope its fine, that I just sent an image instead of the table.
    If needed I can upload the file as well

  3. #3
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,199

    Re: Copy a column in every nth row

    If needed I can upload the file as well
    ....yes please!
    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

  4. #4
    Forum Contributor
    Join Date
    08-31-2022
    Location
    Swiss
    MS-Off Ver
    365
    Posts
    134

    Re: Copy a column in every nth row

    Here we go:

    it is in row 58-68
    Attached Files Attached Files
    Last edited by mrdaave; 10-06-2022 at 06:55 AM.

  5. #5
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,726

    Re: Copy a column in every nth row

    Ignore this

    Pete

  6. #6
    Forum Contributor
    Join Date
    08-31-2022
    Location
    Swiss
    MS-Off Ver
    365
    Posts
    134

    Re: Copy a column in every nth row

    Me or John?

    I could not find a suitable solution for this problem...

    I would really appreciate, if someone knows a formula for this

  7. #7
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,199

    Re: Copy a column in every nth row

    im M59

    =IF(MOD((ROWS($1:1)-1),3)=0,INDEX($D$59:$D$62,INT((ROWS($1:1)-1)/3)+1),"")

    Copy down

    in O59

    =IF($M59="","",VLOOKUP($M59,$D$59:$K$62,COLUMN(C$1),0))

    Copy across and down

    Replace "," with ":"

  8. #8
    Forum Contributor
    Join Date
    08-31-2022
    Location
    Swiss
    MS-Off Ver
    365
    Posts
    134

    Re: Copy a column in every nth row

    I have already tried this with a formula including ROW, INDEX and OFFSET - but somehow I just cant get the right solution...

  9. #9
    Forum Contributor
    Join Date
    08-31-2022
    Location
    Swiss
    MS-Off Ver
    365
    Posts
    134

    Re: Copy a column in every nth row

    Thank you John - I will try this right now

  10. #10
    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,036

    Re: Copy a column in every nth row

    Delete ALL expected results.

    =LET(d,D59:K62,gap,3,rd,ROWS(d),cd,COLUMNS(d),IF(1+MOD(SEQUENCE(rd*gap)-1,gap)=1,INDEX(D59:K62,1+INT(SEQUENCE(rd*gap)/gap),SEQUENCE(,cd)),""))

    format the result area as :

    0;-0;;@

    to hide the zeros in the second column.
    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

  11. #11
    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,036

    Re: Copy a column in every nth row

    On second thoughts... Go with JT's. If you enter anything else, anywhere in the results area, my formula will return a #SPILL error.

  12. #12
    Forum Contributor
    Join Date
    08-31-2022
    Location
    Swiss
    MS-Off Ver
    365
    Posts
    134

    Re: Copy a column in every nth row

    @John: somehow I was not able to use your formula - I cannot get any results

    @Glenn: That looks great! how can I format the result area?

    Anyway I would like to thank both of you for your fast help!

  13. #13
    Forum Contributor
    Join Date
    08-31-2022
    Location
    Swiss
    MS-Off Ver
    365
    Posts
    134

    Re: Copy a column in every nth row

    Okay - Ill try again.
    That`s important, because in the second step, I would like to use a second datapool and fill every second row underneath the name with the same formula

  14. #14
    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,036

    Re: Copy a column in every nth row

    Post a sample sheet showing ALL relevant datasets.

  15. #15
    Forum Contributor
    Join Date
    08-31-2022
    Location
    Swiss
    MS-Off Ver
    365
    Posts
    134

    Re: Copy a column in every nth row

    This should be the final result...

    Its a complex thing for me - but its difficult to change the original data in a form to easy work with (almost 30k entries)
    Attached Files Attached Files

  16. #16
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,199

    Re: Copy a column in every nth row

    See attached
    Attached Files Attached Files

  17. #17
    Forum Contributor
    Join Date
    08-31-2022
    Location
    Swiss
    MS-Off Ver
    365
    Posts
    134

    Re: Copy a column in every nth row

    Thank you John!
    This is now working

    Unfortunately I run into the problem that I cannot use a formula for the second row, because this will overwrite the already calculated results.
    I am sorry, that I didnt post the whole problem in the first place, but i thought, that I can just use the same formula three times...

  18. #18
    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,036

    Re: Copy a column in every nth row

    A dynamic array.

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Ensure that there is NOTHING in the cells where the results are going to spill out.
    Attached Files Attached Files

  19. #19
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,199

    Re: Copy a column in every nth row

    You will need to copy/paste to every 4th row OR use a VBA solution to put the formula in the relevant cells.

  20. #20
    Forum Contributor
    Join Date
    08-31-2022
    Location
    Swiss
    MS-Off Ver
    365
    Posts
    134

    Re: Copy a column in every nth row

    Thank you Glen for your help - i will try to match this to the original Data. I hope that I can manage to write the formula for the big data sheet

    @John: Is it difficult to write a VBA solution for this problem? I am really new to programming - so I am not sure if i can handle that for the original data sheet...

  21. #21
    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,036

    Re: Copy a column in every nth row

    99.9% of the effort there was filling the blank rows in column D. With a VERY minor adjustment it simplifies RADICALLY to:

    =SORT(VSTACK(C30:J33,C38:J41,C46:J49),1,1)

    If you can live with the change, it is sooooo easy.
    Attached Files Attached Files

  22. #22
    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,036

    Re: Copy a column in every nth row

    Even if you add the categories in an additional column to one side of each group... e.g. after July... it can be done easily....

  23. #23
    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,036

    Re: Copy a column in every nth row

    Like this:

    =SORT(CHOOSECOLS(VSTACK(C30:K33,C38:K41,C46:K49),1,9,3,4,5,6,7,8),1,1)
    Attached Files Attached Files

  24. #24
    Forum Contributor
    Join Date
    08-31-2022
    Location
    Swiss
    MS-Off Ver
    365
    Posts
    134

    Re: Copy a column in every nth row

    wow - thats no problem, i can do that easily!

    I will try this solution - the other one is quite difficult to match...

  25. #25
    Forum Contributor
    Join Date
    08-31-2022
    Location
    Swiss
    MS-Off Ver
    365
    Posts
    134

    Re: Copy a column in every nth row

    Okay, I`ve tried this solution but unfortunately I ran into the problem that Excel shows "_xlfn." and as far as I found out, this formula is not working with my Excel-version.

  26. #26
    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,036

    Re: Copy a column in every nth row

    1. Go to File /Account/About Excel. What Version number do you have?

    2. Can you check for upgrades?

    3. Have you enabled editing on ALL of the versions I have produced? If so , which version was the LAST one to work AFTER editing was enabled.

    Hopefully CHOOSECOLS is the problem and we can work around that.

  27. #27
    Forum Contributor
    Join Date
    08-31-2022
    Location
    Swiss
    MS-Off Ver
    365
    Posts
    134

    Re: Copy a column in every nth row

    Microsoft 365 MSO (Version 2202 Build) 64 Bit
    Updates are done properly from the business-administrator - and the product is quite new (max 1,5 months)

    With the dynamic array it stopped working. And I just tried to implement the formula to the original data - thats where I found out, that something is wrong.
    Editing should be enabled.

  28. #28
    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,036

    Re: Copy a column in every nth row

    Please answer Q3 CLEARLY.

  29. #29
    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,036

    Re: Copy a column in every nth row

    I suspect that it'll only work easily with 2203 or later.

    On your version of Excel is VSTACK available? yes or no...

    I do have a workaround... but I need to know how far back I need to go to ensure compatability....

  30. #30
    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,036

    Re: Copy a column in every nth row

    Hello.... RU out there....

    One more Q. Are you OK with the categories being copied down in row D, or do you need them off to the side?

  31. #31
    Forum Contributor
    Join Date
    08-31-2022
    Location
    Swiss
    MS-Off Ver
    365
    Posts
    134

    Re: Copy a column in every nth row

    Q3: All of the the versions have editing enabled. Last version which worked was the first one (dynamic array doesnt work)

    I cannot find the VSTACK formula

  32. #32
    Forum Contributor
    Join Date
    08-31-2022
    Location
    Swiss
    MS-Off Ver
    365
    Posts
    134

    Re: Copy a column in every nth row

    Categories can be in row D - that does not matter at all

  33. #33
    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,036

    Re: Copy a column in every nth row

    Please answer Q at Post 30.

  34. #34
    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,036

    Re: Copy a column in every nth row

    OK. Sorted. It'll take me about 10 mins....

  35. #35
    Forum Contributor
    Join Date
    08-31-2022
    Location
    Swiss
    MS-Off Ver
    365
    Posts
    134

    Re: Copy a column in every nth row

    Thank you so much Glen!
    You`re amazing

  36. #36
    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,036

    Re: Copy a column in every nth row

    Yet another final Q.... In your real sheet, are the 3 data blocks all on the one sheet... or 3 separate ones....

    If all raw data on one sheet - where is the result - same sheet or different?

    If all raw data on separate sheets, where is the result - on a 4th sheet??

  37. #37
    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,036

    Re: Copy a column in every nth row

    OK.

    Enable editing BEFORE replying.

    =LET(a,C30:J33,b,C38:J41,c,C46:J49,ra,ROWS(a),rb,ROWS(b),rc, ROWS(c),x,SEQUENCE(ra+rb+rc),F,INDEX((a,b,c),IF(x>ra+rb,x-(ra+rb),IF(x>ra,x-ra,x)),SEQUENCE(,COLUMNS(a)),IF(x>(ra+rb),2+(x>(ra+rb)),1+(x>ra))),SORT(F,1,1))

    It looks scary, but it's not. If it works for you... fine. If not I'm off to drown my sorrows in the nearest pub.

    If it works OK in the sample, paste it FROM THE FILE into your real data. Make sure there's space for the results to spill out.

    The ONLY bits you need to adjust are the bits in RED. The rest should pretty much look after itself.
    Attached Files Attached Files

  38. #38
    Forum Contributor
    Join Date
    08-31-2022
    Location
    Swiss
    MS-Off Ver
    365
    Posts
    134

    Re: Copy a column in every nth row

    For your final question: raw data all on on sheet and result also on the same sheet (messy but easier to handle )

  39. #39
    Forum Contributor
    Join Date
    08-31-2022
    Location
    Swiss
    MS-Off Ver
    365
    Posts
    134

    Re: Copy a column in every nth row

    I will just try to match it with the real data.

    So far thank you very much for your effort - if it works or not, im just thankful!

  40. #40
    Forum Contributor
    Join Date
    08-31-2022
    Location
    Swiss
    MS-Off Ver
    365
    Posts
    134

    Re: Copy a column in every nth row

    It works!

    Thats just amazing - this will save me so much time in the future, thank you so much

    I think you can go to a pub anyway, I will do so too - and drink one on you as well!

    Thanks again Glen!

  41. #41
    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,036

    Re: Copy a column in every nth row

    Woo Hoo!!

    I never go to the pub before 18:00.... BUT now there's only 51 minutes to wait... If I was in Greece, it would be 18:00 already

  42. #42
    Forum Contributor
    Join Date
    08-31-2022
    Location
    Swiss
    MS-Off Ver
    365
    Posts
    134

    Re: Copy a column in every nth row

    Same for me - but now I can finish work for today and go home (and to a pub to get a good Whiskey)

+ 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. [SOLVED] Insert a new column and copy the column with formula in the left column to the latest col
    By Sakurayuki in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 12-27-2021, 11:29 AM
  2. [SOLVED] Copy one column, but loop through a second column multiple times depending on first column
    By redapplesonly in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-08-2019, 10:12 AM
  3. [SOLVED] Loop through Column B msgboxYesNo if Yes copy to Column C, if No copy to Column D
    By WBravard in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 11-09-2017, 09:46 AM
  4. Copy data from sheet1 column with dynamic date, and copy data to second sheet column
    By Renaliiii in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-25-2016, 04:44 PM
  5. Replies: 1
    Last Post: 05-30-2015, 04:38 PM
  6. Replies: 5
    Last Post: 11-17-2014, 02:40 PM
  7. Vba - find next empty column, insert column, copy paste values & copy paste formulas
    By DoodlesMama in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-20-2012, 12:43 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