+ Reply to Thread
Results 1 to 6 of 6

Transpose from rows to column for everytime the "!" is encountered

  1. #1
    Registered User
    Join Date
    08-04-2011
    Location
    AL
    MS-Off Ver
    Excel 2007
    Posts
    5

    Transpose from rows to column for everytime the "!" is encountered

    Hi everyone ,

    I have a raw data dump out of a system. The data is as below:

    ZPID=JOY
    ZPOINTTYP=1
    ZPTSUBTYP=0
    ZDESC=JOY 2
    ZPLTSYS=###BLANKS###
    ZSYN1=###BLANKS###
    ZSYN2=###BLANKS###
    ZSYN3=###BLANKS###
    ZFREQ=B
    ZPTBCL=NNNNNNNN
    !
    ZPID=JOY2
    ZPOINTTYP=1
    ZPTSUBTYP=0
    ZDESC=JOY 2A
    ZPLTSYS=###BLANKS###
    ZSYN1=###BLANKS###
    ZSYN2=###BLANKS###
    ZSYN3=###BLANKS###
    ZFREQ=B
    ZPTBCL=NNNNNNNN
    ZREMARKS1=###BLANKS###
    ZREMARKS2=###BLANKS###
    ZREMARKS3=###BLANKS###
    ZREMARKS4=###BLANKS###
    ZTECHSPEC=###BLANKS###
    !
    ZPID=JOY3
    ZPOINTTYP=1
    ZPTSUBTYP=0
    ZDESC=JOY 3
    ZPLTSYS=###BLANKS###
    ZSYN1=###BLANKS###
    ZSYN2=###BLANKS###
    ZSYN3=###BLANKS###
    ZFREQ=B
    ZPTBCL=NNNNNNNN
    ZREMARKS1=###BLANKS###
    ZREMARKS2=###BLANKS###
    ZREMARKS3=###BLANKS###
    ZREMARKS4=###BLANKS###
    ZTECHSPEC=###BLANKS###
    ZAGROUP=###BLANKS###
    ZALCTPT=###BLANKS###
    !


    Each record set is separated by the "!" character and the number of rows for each set is not the same.

    I found a formula from this forum that shows how to do it if the number of rows for each set is fixed, below is 99 rows for each set
    =IF(COLUMNS($A:A)>99,"",INDEX($A:$A,COLUMNS($A:A)+99*(ROWS($1:1)-1),1))

    How do i modify this to transpose every time you see "!" character. Thanks for any help you can give,

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Transpose from rows to column for everytime the "!" is encountered

    Do you have a COMPLETE list of possible Zcodes? All the possible lines that might exist in each section?

    I'd think the final result would have the ZCodes across the top of the table output as "headers" one time, then the extracted values for each PID listed on each row, the data found after the = for each parameter.

    Table1.PNG
    Last edited by JBeaucaire; 05-21-2020 at 12:40 PM.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Registered User
    Join Date
    08-04-2011
    Location
    AL
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Transpose from rows to column for everytime the "!" is encountered

    The max Zcodes are 99.

    Here are they:

    ZPID=A-E_DEMIN_JEANS
    ZPOINTTYP=AI
    ZPTSUBTYP=POLY
    ZDESC=A THRU E DEMIN JEANS
    ZPLTSYS=###BLANKS###
    ZSYN1=###BLANKS###
    ZSYN2=###BLANKS###
    ZSYN3=###BLANKS###
    ZFREQ=B
    ZPTBCL=NNNNNNNN
    ZPTPCL=YYYNNNNN
    ZREMARKS1=NOT USED
    ZREMARKS2=###BLANKS###
    ZREMARKS3=###BLANKS###
    ZREMARKS4=###BLANKS###
    ZTECHSPEC=###BLANKS###
    IDBSECUR=15
    IADCAMP=1
    IPOLYDG=1
    IG2COMP=0
    ZOTD=N
    ZREFJTP=###BLANKS###
    ZSNELUN=V
    XCOEFF00=-24.66091
    XCOEFF01=24.66091
    XSNELLO=1.000000E+00
    XSNELHI=5.120000E+00
    XRELMLO=1.000000E+00
    XRELMHI=5.055000E+00
    ZMUXCRD=###BLANKS###
    ZLALARM01=NA
    ZLALARM02=NA
    ZLALARM03=NA
    ZLALARM04=NA
    ZLALARM05=NA
    ZLALARM06=NA
    ZLALARM07=NA
    ZLALARM08=NA
    ZLWARN01=NA
    ZLWARN02=NA
    ZLWARN03=NA
    ZLWARN04=NA
    ZLWARN05=NA
    ZLWARN06=NA
    ZLWARN07=NA
    ZLWARN08=NA
    ZUALARM01=NA
    ZUALARM02=NA
    ZUALARM03=NA
    ZUALARM04=NA
    ZUALARM05=NA
    ZUALARM06=NA
    ZUALARM07=NA
    ZUALARM08=NA
    ZUWARN01=NA
    ZUWARN02=NA
    ZUWARN03=NA
    ZUWARN04=NA
    ZUWARN05=NA
    ZUWARN06=NA
    ZUWARN07=NA
    ZUWARN08=NA
    XCOMPRESS=1.000000E-01
    XCLAMP=-1.000000E+08
    XALDBND=0.000000E+00
    XREALARM=0.000000E+00
    ZENGRUN=PPB
    IDSFRAC=3
    XENRNLO=0.000000E+00
    XENRNHI=1.000000E+02
    ZHWDCHN=1A360305
    IALDESTIN=0
    IALMRESP=0
    ZAGROUP=###BLANKS###
    ZALCTPT=###BLANKS###
    ZALMPRI=0
    ZSPALPR=###BLANKS###
    ITRAPNT=0
    ZINPNT01=###BLANKS###
    ZINPNT02=###BLANKS###
    ZINPNT03=###BLANKS###
    ZINPNT04=###BLANKS###
    ZINPNT05=###BLANKS###
    ZINPNT06=###BLANKS###
    ZINPNT07=###BLANKS###
    ZINPNT08=###BLANKS###
    ZINPNT09=###BLANKS###
    ZINPNT10=###BLANKS###
    ZINPNT11=###BLANKS###
    ZINPNT12=###BLANKS###
    ZINPNT13=###BLANKS###
    ZINPNT14=###BLANKS###
    ZINPNT15=###BLANKS###
    ZINPNT16=###BLANKS###
    ZINPNT17=###BLANKS###
    ZINPNT18=###BLANKS###
    ZINPNT19=###BLANKS###
    ZINPNT20=###BLANKS###
    !

  4. #4
    Registered User
    Join Date
    08-04-2011
    Location
    AL
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Transpose from rows to column for everytime the "!" is encountered

    how do i code what you are proposing here

  5. #5
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Transpose from rows to column for everytime the "!" is encountered

    Someone might come up with a formula based analysis, I find it easier to simply transform the data using a macro. I've written one for you to do this transformation.

    Drop your data into column A on the DATA sheet, then click the button.

    Your results will appear on the OUTPUT sheet.

    If you clear the OUTPUT sheet, remember to leave row 1 alone, that is being used by the macro to identify where the values from the DATA sheet should go.

    Please Login or Register  to view this content.
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    08-04-2011
    Location
    AL
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Transpose from rows to column for everytime the "!" is encountered

    This looks awesome!
    thank you so very much, you are a genius!

+ 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. Adding new rows using VBA everytime there is an "Error"
    By Azhar1997 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-29-2019, 05:32 AM
  2. [SOLVED] Column X-Ref list - Sheet1 Col A "pages", Col B:FL "Req" to Sheet2 ColA "req", ColB "page"
    By excel-card-pulled in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 04-07-2017, 09:30 AM
  3. Need Macro support to transpose from row to column for "n" no of rows
    By Abraham Moses in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-07-2015, 03:49 PM
  4. Replies: 1
    Last Post: 02-04-2014, 08:43 PM
  5. [SOLVED] Copy multiple rows that contain a certain "name" in column "A" then paste it into new work
    By rschlot2 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-18-2013, 02:25 PM
  6. Replies: 2
    Last Post: 05-05-2008, 04:51 PM
  7. [SOLVED] transpose the code from "rows" to "columns"
    By markx in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-21-2005, 05:05 AM

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