+ Reply to Thread
Results 1 to 14 of 14

Reorganize data

  1. #1
    Registered User
    Join Date
    07-05-2009
    Location
    Hong Kong
    MS-Off Ver
    Excel 2003
    Posts
    8

    Reorganize data

    Hello,

    Is there any easy method to tranform the table from Tabel 1 to 2?

    TABLE 1
    Date Name Level
    11/6/2009 A 65.12
    12/6/2009 A 65.84
    13/6/2009 A 24.65
    14/6/2009 A 24.95
    15/6/2009 A 12.95
    16/6/2009 A 74.65
    17/6/2009 A 54.32
    18/6/2009 A 41.95
    19/6/2009 A 65.54
    11/6/2009 B 25.13
    12/6/2009 B 43.21
    13/6/2009 B 65.12
    14/6/2009 B 43.12
    15/6/2009 B 64.24
    16/6/2009 B 65.12
    17/6/2009 B 65.84
    18/6/2009 B 24.65
    19/6/2009 B 24.95
    11/6/2009 C 12.95
    12/6/2009 C 74.65
    13/6/2009 C 54.32
    14/6/2009 C 41.95
    15/6/2009 C 65.54
    16/6/2009 C 25.13
    17/6/2009 C 43.21
    18/6/2009 C 65.12
    19/6/2009 C 43.12

    TABLE 2
    Date A B C
    11/6/2009 65.12 25.13 12.95
    12/6/2009 65.84 43.21 74.65
    13/6/2009 24.65 65.12 54.32
    14/6/2009 24.95 43.12 41.95
    15/6/2009 12.95 64.24 65.54
    16/6/2009 74.65 65.12 25.13
    17/6/2009 54.32 65.84 43.21
    18/6/2009 41.95 24.65 65.12
    19/6/2009 65.54 24.95 43.12
    Last edited by pentiumeric; 07-08-2009 at 06:36 AM. Reason: solved

  2. #2
    Forum Contributor mubashir aziz's Avatar
    Join Date
    03-18-2009
    Location
    Lahore, Pakistan
    MS-Off Ver
    MS Office 2013
    Posts
    533

    Re: Reorganize data

    See attached file hope it will work for you ......

    You can check this thread as well ....

    http://www.excelforum.com/excel-gene...33-sum-if.html
    Attached Files Attached Files
    Last edited by mubashir aziz; 07-06-2009 at 02:56 AM.
    If this post helps, Please don't 4get to click the star icon located at the bottom left of my Post.

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

    Re: Reorganize data

    A macro version to do the same thing. Remove the last line of code if you do not want the original table removed:
    Please Login or Register  to view this content.
    _________________
    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!)

  4. #4
    Registered User
    Join Date
    07-05-2009
    Location
    Hong Kong
    MS-Off Ver
    Excel 2003
    Posts
    8

    Re: Reorganize data

    Thanks JB & mubashir aziz!

    Actually, my table do have more Names, not only A, B, C.
    There are over 20 of them. And would changes everytime. It is possible to auto detect the numbers of unique name?

    As I dont have any ideas of VB

    Thanks Again!

  5. #5
    Forum Contributor mubashir aziz's Avatar
    Join Date
    03-18-2009
    Location
    Lahore, Pakistan
    MS-Off Ver
    MS Office 2013
    Posts
    533

    Re: Reorganize data

    You can do it without using VBA .......

    http://www.excelforum.com/excel-gene...33-sum-if.html

  6. #6
    Registered User
    Join Date
    07-05-2009
    Location
    Hong Kong
    MS-Off Ver
    Excel 2003
    Posts
    8

    Re: Reorganize data

    Quote Originally Posted by mubashir aziz View Post
    You can do it without using VBA .......

    http://www.excelforum.com/excel-gene...33-sum-if.html
    I have tried your method without VBA. It works...
    But i am doing some performance analysis on SAN. There will be few thousands of row in a file..and over 10 csv files need to be updated weekly

    So i prefer using VBA..which seems quicker

    Thx!

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

    Re: Reorganize data

    Each time you run this, do you need the reports to ADD to the tables already created, or does it create a new table each time similar to how my first macro created a unique table based on the data?

  8. #8
    Registered User
    Join Date
    07-05-2009
    Location
    Hong Kong
    MS-Off Ver
    Excel 2003
    Posts
    8

    Re: Reorganize data

    I would need to create a new table each time. e.g (10 input --> 10 output)

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

    Re: Reorganize data

    Use this one, it will create a chart with any number of dates and any number of names each time you run it.
    Please Login or Register  to view this content.
    I eliminated the loop so every line isn't individually evaluated.

  10. #10
    Registered User
    Join Date
    07-05-2009
    Location
    Hong Kong
    MS-Off Ver
    Excel 2003
    Posts
    8

    Re: Reorganize data

    Thx JB,
    I have some problems with it.
    The values are zero after the table transformation The Name and Date are all correct.


    Attached test and result.
    Attached Files Attached Files
    Last edited by pentiumeric; 07-07-2009 at 03:45 AM.

  11. #11
    Registered User
    Join Date
    07-05-2009
    Location
    Hong Kong
    MS-Off Ver
    Excel 2003
    Posts
    8

    Re: Reorganize data

    btw, what is the meaning of LR = Range("A" & Rows.Count).End(xlUp).Row?

    I have a VBA book in hand, and trying to understand the coding.

    Thx again JB

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

    Re: Reorganize data

    Yeah, my bad. I used the wrong "end row" for the sumproduct() formula being used. Here you go...apologies.
    Please Login or Register  to view this content.

  13. #13
    Registered User
    Join Date
    07-05-2009
    Location
    Hong Kong
    MS-Off Ver
    Excel 2003
    Posts
    8

    Re: Reorganize data

    JB!! You are my HERO!!

    Thanks for your script!! It works perfectly!

  14. #14
    Registered User
    Join Date
    07-05-2009
    Location
    Hong Kong
    MS-Off Ver
    Excel 2003
    Posts
    8

    Re: Reorganize data

    a off-forum question.

    Could the same process done without using excel? (e.g cmd, vbscript)

+ 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