- AuthorPosts
- May 26, 2025 at 7:14 pm #30252
David
ParticipantI frequently face the following requirement, and would appreciate some advice from you all.
These files may have tens or even hundreds of lines (we can think of it as a single column of data).
Let’s assume a file has one column and consists of 9 lines. I need to split this into 3 columns, so lines 1-3 remain in Column A, lines 4-6 are moved to Column B, and lines 7-9 are moved to Column C. The columns should be separated by commas.Original File:
1
2
3
4
5
6
7
8
9Desired Output:
Column A,Column B,Column C
1,4,7
2,5,8
3,6,9If the file has 10 lines, then, compared to the previous example, it would have a Column D only contains the last number 10.
Desired Output:
Column A,Column B,Column C,Column D
1,4,7,10
2,5,8
3,6,9The above is just a simple example. In fact, the number of lines to split each time may vary — the example used 3, but it could also be 10 or another number.
Do you have any idea how to handle it quickly? Now I handle them manually.May 27, 2025 at 8:27 am #30253Patrick C
ParticipantMay 27, 2025 at 8:47 pm #30256David
ParticipantHello Patrick, this macro is amazing; it perfectly solved my problem. I sincerely appreciate your help. Thank you!
May 28, 2025 at 5:41 am #30257Patrick C
ParticipantGlad I could help.
Thanks for your feedback! - AuthorPosts
- You must be logged in to reply to this topic.