+ Reply to Thread
Results 1 to 9 of 9

Transpose data based on field separator

  1. #1
    Forum Contributor
    Join Date
    10-30-2019
    Location
    GUJARAT,INDIA
    MS-Off Ver
    MS OFFICE 2016
    Posts
    235

    Transpose data based on field separator

    Hi!
    can anyone on this forum provide for following description :-

    Line below each record is "------------------------------------" is record separator. code should search this record separator
    and wherever this record separator is found copy rows above and paste it in sheet 2 side by side(transpose)
    i.e. PASTE ALL DATA OF ROW 1 TO A1 ON SHEET2. and then again repeat this process for second record and so on.
    Above explanation will help in providing solution.
    Attached Files Attached Files

  2. #2
    Forum Contributor Dante Amor's Avatar
    Join Date
    07-24-2020
    Location
    MEXICO
    MS-Off Ver
    Excel 2013
    Posts
    212

    Re: Transpose data based on field separator

    The end goal is sheet4?

    On your sheet you have "Records" of 5 lines and also 4 lines.
    Do you only want the 5 lines?

    Attachment 691017

    Below the double line you have rows to copy. Is that correct?

    Attachment 691021

    Another pattern I see is that the "Records" start with a number, is that correct?

  3. #3
    Forum Contributor
    Join Date
    10-30-2019
    Location
    GUJARAT,INDIA
    MS-Off Ver
    MS OFFICE 2016
    Posts
    235

    Re: Transpose data based on field separator

    Yes , The end goal is sheet4.
    Yes , I want all records(no matter how much line a record has). If record contains 4 lines than fifth row should be blank
    in Sheet 4
    Yes, Above the double line I have rows to copy.
    Yes, First row of each record start with number.

  4. #4
    Forum Contributor
    Join Date
    10-30-2019
    Location
    GUJARAT,INDIA
    MS-Off Ver
    MS OFFICE 2016
    Posts
    235

    Re: Transpose data based on field separator


  5. #5
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 365 version 2504
    Posts
    19,350

    Re: Transpose data based on field separator

    This is a formula based proposal that employs a lot of helper columns populated by relatively simple formulas.
    The first helper column (D) is populated using: =IF(VALUE(LEFT(TRIM(A2),4))< 36000,1,IF(D1<=4,SUM(D1,1),""))
    The next four helper columns are populated using: =IF(D1=COLUMNS($A1:A1),SUM(D1,1),"")
    The next helper column is populated using: =IF(LEFT(A2,1)="-","",AGGREGATE(15,6,D2:H2/ISNUMBER(D2:H2),1))
    The next five helper columns are populated using: =IFERROR(INDEX($A$2:$A$100,AGGREGATE(15,6,(ROW($A$2:$A$100)-ROW($A$1))/($I$2:$I$100=COLUMNS($A$1:A$1)),ROWS($A$1:$A1))),"")
    The final result is in column O which is populated using: =CONCATENATE(J2,K2,L2,M2,N2)
    Let us know if you have any questions.
    Attached Files Attached Files
    Consider taking the time to add to the reputation of everybody that has taken the time to respond to your query.

  6. #6
    Forum Contributor
    Join Date
    10-30-2019
    Location
    GUJARAT,INDIA
    MS-Off Ver
    MS OFFICE 2016
    Posts
    235

    Re: Transpose data based on field separator

    Thanks. Your formulas are excellent. But giving result for only first 18 records.

    My original file contains 1000 records(each record is seperated by "--------------".
    Kindly update formulas so that I can get result for all 1000 records.

  7. #7
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 365 version 2504
    Posts
    19,350

    Re: Transpose data based on field separator

    The only formula that should need modification is the formula for columns J:N.
    As for the other formulas they can dragged down to the last row of the last record.
    I am guessing the 1,000 records may occupy 100,000 rows so the formula in cell J2 could be modified to read:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Once the formula is pasted into cell J2 then drag the fill handle over to cell N2 and then, while cells J2:N2 are still selected, drag the fill handle down to the last row of the last record.
    Note that the formula will possibly take some time to complete calculation, so please be patient.
    Let us know if you have any questions.

  8. #8
    Forum Contributor
    Join Date
    10-30-2019
    Location
    GUJARAT,INDIA
    MS-Off Ver
    MS OFFICE 2016
    Posts
    235

    Re: Transpose data based on field separator

    Excellent solution. My problem is solved. Thanks once again for your time and efforts..

  9. #9
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 365 version 2504
    Posts
    19,350

    Re: Transpose data based on field separator

    You're Welcome. Thank You for the feedback and for marking the thread as 'Solved'. I hope that you have a blessed day.

+ 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] Mandatory Field Based of Data of Previous Field
    By JCRoessler14 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 08-19-2016, 06:03 PM
  2. [SOLVED] Split text avoiding field separator within double quotes
    By cgkmal in forum Excel Programming / VBA / Macros
    Replies: 18
    Last Post: 05-22-2014, 01:04 PM
  3. [SOLVED] Mandatory Field or unable to save based another field having data
    By jingles9 in forum Excel Formulas & Functions
    Replies: 15
    Last Post: 06-18-2013, 11:18 AM
  4. Replies: 2
    Last Post: 04-10-2012, 10:38 AM
  5. [SOLVED] Modify code to transpose a stack of data to rows on to delimit on text hone number field
    By coachtim in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-26-2012, 02:52 PM
  6. Macros for load/save CSV files using pipe as field separator
    By Blade838 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-23-2007, 08:14 PM
  7. [SOLVED] Problem with the file format xlCSV and a field separator
    By sarimari in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-22-2005, 03:06 AM

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