+ Reply to Thread
Results 1 to 34 of 34

Regarding breaking of occuring data into rows of a table

  1. #1
    Registered User
    Join Date
    04-09-2012
    Location
    Singapore
    MS-Off Ver
    Excel 2010
    Posts
    54

    Regarding breaking of occuring data into rows of a table

    Hi all,

    As metion from the title, i have a little trouble regarding breaking down the data in a row.

    Right now what the data i have is


    -----A----------B----------C-------------D------------E-----------F----------G ------------H----------I ----------J---------K-|________|_________|__________|___________|___________|________|___________|___________|________|________| _________|
    |----1 -----|--------| ---2 ----- |----------- | -----3 ------| ----------- |------1 ------|-------|------2------| -------| ------3 ------


    to

    -----A----------B----------C----
    |________|_________|__________|
    ---1---- ---2---- ---3----
    ---1---- ---2---- ---3----
    ---1---- ---2---- ---3----
    Last edited by andywsw; 04-10-2012 at 03:36 AM.

  2. #2
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Regarding breaking of occuring data into rows of a table

    It will be better if you post a sample file so we can understand the layout better.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  3. #3
    Registered User
    Join Date
    04-09-2012
    Location
    Singapore
    MS-Off Ver
    Excel 2010
    Posts
    54

    Re: Regarding breaking of occuring data into rows of a table

    Roger ! =) , btw how do i upload an excel file ? new here sorry breakdatatest.JPG
    Last edited by andywsw; 04-10-2012 at 03:51 AM.

  4. #4
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Regarding breaking of occuring data into rows of a table

    To Attach a File:

    1. Scroll down to the window below your post Additional Options
    2. In the frame Attach Files you will see the button Manage Attachments
    3. Click the button.
    4. A new window will open titled Manage Attachments - Excel Forum.
    5. Click the Browse... button to locate your file for uploading.
    6. This will open a new window File Upload.
    7. Once you have located the file to upload click the Open button. This window will close.
    8. You are now back in the Manage Attachments - Excel Forum window.
    9. Click the Upload button and wait until the file has uploaded.
    10. Close the window and then click Submit.

  5. #5
    Registered User
    Join Date
    04-09-2012
    Location
    Singapore
    MS-Off Ver
    Excel 2010
    Posts
    54

    Re: Regarding breaking of occuring data into rows of a table

    breakdatatest.xls here ! Thanks !

  6. #6
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Regarding breaking of occuring data into rows of a table

    So there wouldnt be headings in columns G to Q?

  7. #7
    Registered User
    Join Date
    04-09-2012
    Location
    Singapore
    MS-Off Ver
    Excel 2010
    Posts
    54

    Re: Regarding breaking of occuring data into rows of a table

    There is not headings for that columns , as the data going to be shift into a table so that filtering can be apply onto the table

  8. #8
    Registered User
    Join Date
    04-09-2012
    Location
    Singapore
    MS-Off Ver
    Excel 2010
    Posts
    54

    Re: Regarding breaking of occuring data into rows of a table

    Also jsut to add on , please use this excel workbook instead breakdatatest.xls

  9. #9
    Registered User
    Join Date
    04-09-2012
    Location
    Singapore
    MS-Off Ver
    Excel 2010
    Posts
    54

    Re: Regarding breaking of occuring data into rows of a table

    Quote Originally Posted by andywsw View Post
    Also jsut to add on , please use this excel workbook instead Attachment 149600
    i have change the layout to match my current work

  10. #10
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Regarding breaking of occuring data into rows of a table

    Are there chances of having more rows of data, like in row 4, 5, 6 etc?

  11. #11
    Registered User
    Join Date
    04-09-2012
    Location
    Singapore
    MS-Off Ver
    Excel 2010
    Posts
    54

    Re: Regarding breaking of occuring data into rows of a table

    Quote Originally Posted by arlu1201 View Post
    Are there chances of having more rows of data, like in row 4, 5, 6 etc?
    yes ! i got the feeling i have to shift those rows down so that those data can be insert to the rows

    Note that each row will have the similar reoccuring data but some might have a longer data pattern
    for example

    row 1 have 3 students as shown ,
    row 2 will have 4 students

    so the number of student data is varies

    so the end product i am seek for advice is that

    Row1 Data.row1
    ------Data.row1
    ------Data.row1
    row2 data.row2
    ------data.row2
    ------data.row2
    ------data.row2
    row3 data.row3
    row4 data.row4
    ------data.row4
    Last edited by andywsw; 04-10-2012 at 04:27 AM.

  12. #12
    Registered User
    Join Date
    04-09-2012
    Location
    Singapore
    MS-Off Ver
    Excel 2010
    Posts
    54

    Re: Regarding breaking of occuring data into rows of a table

    sorry for the long thread ,

    just to add on to the data , regardin All row of data , each data has the first heading the same , maybe this could easier like search for every occuring CLass number then pull in into another row thats what i thought =)

    Also if you would ask me how do i get this data layout , it is from email generated values, ( outlook 2010 message body with table ) it was at first in one long message in warp text in a single cell then i split my char(13) them using some vba codes and i end up here ! haha =)


    below here are sample values :

    Row 1 data : 1 james 12 male 1 lousi 13 male
    row 2 data : 1 happy 13 male 1 john 14 male



    Class Name Age Gender
    1 James 12 Male
    1 Louis 13 Male



    Class Name Age Gender
    1 Happy 12 Male
    1 John 13 Male
    Last edited by andywsw; 04-10-2012 at 05:12 AM.

  13. #13
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,666

    Re: Regarding breaking of occuring data into rows of a table

    Try the attached

    breakdatatestWithCode.xls

  14. #14
    Registered User
    Join Date
    04-09-2012
    Location
    Singapore
    MS-Off Ver
    Excel 2010
    Posts
    54

    Re: Regarding breaking of occuring data into rows of a table

    Quote Originally Posted by jindon View Post
    Try the attached

    Attachment 149605
    Thanks for the help , will try and let you know if its working ! =) thanks

  15. #15
    Registered User
    Join Date
    04-09-2012
    Location
    Singapore
    MS-Off Ver
    Excel 2010
    Posts
    54

    Re: Regarding breaking of occuring data into rows of a table

    Quote Originally Posted by andywsw View Post
    sorry for the long thread ,

    just to add on to the data , regardin All row of data , each data has the first heading the same , maybe this could easier like search for every occuring CLass number then pull in into another row thats what i thought =)

    Also if you would ask me how do i get this data layout , it is from email generated values, ( outlook 2010 message body with table ) it was at first in one long message in warp text in a single cell then i split my char(13) them using some vba codes and i end up here ! haha =)


    below here are sample values :

    Row 1 data : 1 james 12 male 1 lousi 13 male
    row 2 data : 1 happy 13 male 1 john 14 male



    Class Name Age Gender
    1 James 12 Male
    1 Louis 13 Male



    Class Name Age Gender
    1 Happy 12 Male
    1 John 13 Male
    Quote Originally Posted by jindon View Post
    Try the attached

    Attachment 149605
    @ jindon just a question Let say if i have 11 Headings ( the acutal ) rather than 4 , what am i suppose to change? and the following quote above regarding the first heading how do i add in ? Many Thanks =)

    i did try some modification with the codes, what i did was changing all 4 to 11 ( which i assume was the number of headings) , i got an out of memory error
    Last edited by andywsw; 04-10-2012 at 05:51 AM.

  16. #16
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,666

    Re: Regarding breaking of occuring data into rows of a table

    You need to upload the file again with the desired results.

    Sheet structure should be exact to the actual sheet. (dummy data should be OK)

  17. #17
    Registered User
    Join Date
    04-09-2012
    Location
    Singapore
    MS-Off Ver
    Excel 2010
    Posts
    54

    Exclamation Re: Regarding breaking of occuring data into rows of a table

    Quote Originally Posted by jindon View Post
    You need to upload the file again with the desired results.

    Sheet structure should be exact to the actual sheet. (dummy data should be OK)
    i have attach to excat copy of how my lay out is please take alook and advice me on the marco/vba . Thanks alot !

    THIS is the laterest version copy >>>>> breakdatatest3.xls <<<<<


    * Do not take the below copy * V
    Attached Files Attached Files
    Last edited by andywsw; 04-10-2012 at 09:46 PM.

  18. #18
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,666

    Re: Regarding breaking of occuring data into rows of a table

    You are asking completely different question this time.
    Please Login or Register  to view this content.

  19. #19
    Registered User
    Join Date
    04-09-2012
    Location
    Singapore
    MS-Off Ver
    Excel 2010
    Posts
    54

    Re: Regarding breaking of occuring data into rows of a table

    I am sorry about that , i thought gave a simple data so to easier to relate >.<
    Thanks for ur kind effort to help me , i shall try the codes !

  20. #20
    Registered User
    Join Date
    04-09-2012
    Location
    Singapore
    MS-Off Ver
    Excel 2010
    Posts
    54

    Re: Regarding breaking of occuring data into rows of a table

    hi ! i got a subscript out of range , any ideas ?


    i tried on the dummy data , it works perfectly !

    but when i shift over the codes to the actual data it gives that error ! ( using the same format layout as the dummy data )




    also if it is possible that you can explain to me the codes that you wrote, there are some i had not explore before ! something new to learn from you =)



    thanks
    Last edited by andywsw; 04-11-2012 at 01:37 AM.

  21. #21
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,666

    Re: Regarding breaking of occuring data into rows of a table

    I don't understand what you are talking about.

    see attached

    breakdatatest2WithCode.xls

  22. #22
    Registered User
    Join Date
    04-09-2012
    Location
    Singapore
    MS-Off Ver
    Excel 2010
    Posts
    54

    Re: Regarding breaking of occuring data into rows of a table

    error.JPG please review this image ! for clearer understanding

  23. #23
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,666

    Re: Regarding breaking of occuring data into rows of a table

    You seems to change the sheet references.

    As long as the file that I attached is running without problem, I can not help you anymore.

  24. #24
    Registered User
    Join Date
    04-09-2012
    Location
    Singapore
    MS-Off Ver
    Excel 2010
    Posts
    54

    Re: Regarding breaking of occuring data into rows of a table

    alright thanks for your time and effor to help me , appreciate it ! i shall try to take it from here ! Once again thank you !

    btw , just a small little favour, may you add the codes explaination of each line does, so that i know how this magic codes works ! =) and i can modify accordingly =)

  25. #25
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,666

    Re: Regarding breaking of occuring data into rows of a table

    Tell me where do you not understand specifically?

  26. #26
    Registered User
    Join Date
    04-09-2012
    Location
    Singapore
    MS-Off Ver
    Excel 2010
    Posts
    54

    Re: Regarding breaking of occuring data into rows of a table

    Quote Originally Posted by jindon View Post
    You are asking completely different question this time.
    Please Login or Register  to view this content.
    The highlighted codes above are the areas i not quite sure about it

  27. #27
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,666

    Re: Regarding breaking of occuring data into rows of a table

    1) Step debug the code.
    While you are in VBE, got to [View] - [Local Window]
    Click on somewhere on the code (sub test)
    As you hit F8, it will execute line by line and at the same time you will see all the variables in Local Window.
    So that you will see what it going on to the variables.
    If you see "+" on the variable, e.g.Variable "a" and "b", they are arrays, you can expand and see inside the array.

    2) Get vb Help or google the keywords that you don't understand, such like

    Array, Lbound, Ubound, For Loop, Step

    You will need to learn all about these keywords first, otherewise you will never be able to understand the code.

  28. #28
    Registered User
    Join Date
    04-09-2012
    Location
    Singapore
    MS-Off Ver
    Excel 2010
    Posts
    54

    Re: Regarding breaking of occuring data into rows of a table

    i did look up on those terms you mention few weeks ago , i do understand them somehow ;') ,

    after i open the local window ,(
    like

    b(1,3) student Ben 15/4/2010 23/4/2010 23/3/2011
    b(1,4) lim 23 1 85 6.3 too talkative

    i happen to notice that each array , the data of a particular student was split half on each line

  29. #29
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,666

    Re: Regarding breaking of occuring data into rows of a table

    I don't know.

    It is only you who is able to see actual file, so no idea.

  30. #30
    Registered User
    Join Date
    04-09-2012
    Location
    Singapore
    MS-Off Ver
    Excel 2010
    Posts
    54

    Re: Regarding breaking of occuring data into rows of a table

    Quote Originally Posted by jindon View Post
    You are asking completely different question this time.
    Please Login or Register  to view this content.
    Regarding the above code , can anyone explaint to me the first bold part ?

  31. #31
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,666

    Re: Regarding breaking of occuring data into rows of a table

    The Loop commence from End of the column to column1 backwards.

    It will delete the columns that has no data.

  32. #32
    Registered User
    Join Date
    04-09-2012
    Location
    Singapore
    MS-Off Ver
    Excel 2010
    Posts
    54

    Re: Regarding breaking of occuring data into rows of a table

    sorry to bother you = S

    just a few questions

    1) regarding this code would it be affected if there is more headings ( like new headings being added into the existing data)?

    2) regarding the code i have problem understanding this line ReDim b(1 To UBound(a, 1) * UBound(a, 2) \ 11, 1 To UBound(a, 2)) on the bold part , why 11?

    3) i realise that those empty column do contain some value but is not visible , this was result when i split the messages ( words are connect , no space in between words , like one long string of words )

    using this code
    'splits Text active cell using ALT+10 char as separator
    Application.ScreenUpdating = False
    Dim splitVals As Variant
    Dim totalVals As Long
    'split every row untill is empty
    Worksheets("sheet2").Activate
    Range("F2").Select
    Do Until IsEmpty(ActiveCell.Value)
    splitVals = Split(ActiveCell.Value, Chr(13))
    totalVals = UBound(splitVals)
    Range(Cells(ActiveCell.Row, ActiveCell.Column + 1), Cells(ActiveCell.Row, ActiveCell.Column + 1 + totalVals)).Value = splitVals
    ActiveCell.Offset(1, 0).Select
    Loop


    Which resulted some spacing or value at the empty column , so how do i add on to your existing code to remove them or are they treated as empty column ?
    Last edited by andywsw; 04-11-2012 at 10:12 PM.

  33. #33
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,666

    Re: Regarding breaking of occuring data into rows of a table

    When we are talking about different files, I can not comment anymore.

    I have written the code fully based on the data structure of your sample data, so if it is different from the sample, I can tell you nothing.

    Sorry, but you need to understand that we are going nowhere if we keep discussing like this.

  34. #34
    Registered User
    Join Date
    04-09-2012
    Location
    Singapore
    MS-Off Ver
    Excel 2010
    Posts
    54

    Re: Regarding breaking of occuring data into rows of a table

    your right ! hmm once again sorry and thanks for your kind effort

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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