+ Reply to Thread
Results 1 to 8 of 8

Table Data to Matrix

  1. #1
    Registered User
    Join Date
    07-23-2014
    Location
    London
    MS-Off Ver
    2010
    Posts
    5

    Table Data to Matrix

    Hello,

    I have a data in table format. The data is not normalized meaning for some rows in some columns the data repeats. I want to transform the data to a matrix with unique row and column captions based on 2 columns of the original data, and then fill the matrix based on 3rd column. I prepared the matrix row and column captions with unique data, but when it comes filling the matrix based on a column value it takes very long time to complete (I have 60,000 rows in the data which i am trying to transform). I would be very grateful if someone helps me to find the fastest way to place the original data into the matrix.

    To make it more clear, I attach the small spreadsheet as a sample. The original data is in range "A2:C11" in Sheet1. Based on column "A" I already generated matrix row captions using unique data in column DEAL_ID, and based on unique data on column DEAL_DATE - column captions in Sheet2. The original data is already sorted first according to DEAL_ID column, then DEAL_DATE column. I just need the fastest way to will DEAL_AMOUNT column into the matrix using VBA. I know that I can use INDEX(MATCH()) to do it with built-in functions, but this is only a small piece of total picture, and I need this part in VBA, and INDEX(MATCH()) is slow enough, I think there is a faster way.


    Many thanks in advance for your response.
    Attached Files Attached Files
    Last edited by uahmadov; 06-14-2015 at 06:40 AM. Reason: changed attachment

  2. #2
    Registered User
    Join Date
    07-23-2014
    Location
    London
    MS-Off Ver
    2010
    Posts
    5

    Re: Table Data to Matrix

    Here is my code, but I think there is a better and faster way of doing it:

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    07-23-2014
    Location
    London
    MS-Off Ver
    2010
    Posts
    5

    Re: Table Data to Matrix

    Here is my code, but I think there is a better and faster way of doing it:

    Please Login or Register  to view this content.

  4. #4
    Forum Guru karedog's Avatar
    Join Date
    10-03-2014
    Location
    Indonesia
    MS-Off Ver
    2003
    Posts
    2,971

    Re: Table Data to Matrix

    Hi,

    Is this fast enough for you ?

    Please Login or Register  to view this content.

    Regards
    1. I care dog
    2. I am a loop maniac
    3. Forum rules link : Click here
    3.33. Don't forget to mark the thread as solved, this is important

  5. #5
    Registered User
    Join Date
    07-23-2014
    Location
    London
    MS-Off Ver
    2010
    Posts
    5

    Re: Table Data to Matrix

    I figured that the fastest way is just

    Please Login or Register  to view this content.
    Last edited by uahmadov; 06-14-2015 at 10:10 AM. Reason: typo

  6. #6
    Forum Guru karedog's Avatar
    Join Date
    10-03-2014
    Location
    Indonesia
    MS-Off Ver
    2003
    Posts
    2,971

    Re: Table Data to Matrix

    Really ?

    Please upload your workbook, we will make a little comparison benchmark (using Excel as the time counter, not human feeling).

    Regards

  7. #7
    Registered User
    Join Date
    07-23-2014
    Location
    London
    MS-Off Ver
    2010
    Posts
    5

    Re: Table Data to Matrix

    Sorry, the real data is confidential

  8. #8
    Forum Guru karedog's Avatar
    Join Date
    10-03-2014
    Location
    Indonesia
    MS-Off Ver
    2003
    Posts
    2,971

    Re: Table Data to Matrix

    Ok, in that case, I will provide the data

    Please Login or Register  to view this content.

    Just run the Sub Benchmark() and watch the result
    On my machine :
    Mine : 0.7351 seconds
    Yours : 11.1822 seconds

    Mine take 6.57% time of yours.



    Regards
    Attached Files Attached Files

+ 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] converting matrix data into a table
    By Red fuji in forum Excel General
    Replies: 16
    Last Post: 06-28-2012, 12:21 PM
  2. Using data contained in a matrix table on another sheet
    By redimp in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-18-2010, 01:50 PM
  3. Converting Data Table to Matrix Format
    By vioravis in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 01-29-2009, 06:35 AM
  4. Pulling data from a matrix/table
    By tedium in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 09-23-2006, 07:37 AM
  5. Locate and retrivie data in table/matrix
    By stefan7219 in forum Excel Formulas & Functions
    Replies: 17
    Last Post: 09-16-2005, 10:05 PM

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