+ Reply to Thread
Results 1 to 10 of 10

Table Consolidation

  1. #1
    Registered User
    Join Date
    11-22-2014
    Location
    US
    MS-Off Ver
    Office 365
    Posts
    83

    Table Consolidation

    I need help on developing a macro to consolidate data of table in a sheet to another.
    I have got a sheet which has got a table of data that is dynamic and i want it to be consolidated into a table in a new sheet.

    I am able to do it using simple sum consolidate method manually but the same isn't working via vba.

    Table will be like,

    saf fdg ghj hjk
    A 1 2 3 7
    B 65 54 54 21
    A 21 584 54 523
    D 12 42 58 21

    Output should be like,

    saf fdg ghj hjk
    A 22 586 57 530
    B 65 54 54 21
    D 12 42 58 21

  2. #2
    Forum Expert MickG's Avatar
    Join Date
    11-23-2007
    Location
    Banbury,Oxfordshire
    Posts
    2,650

    Re: Table Consolidation

    Try this , Results sheet2.
    Please Login or Register  to view this content.
    Regards Mick

  3. #3
    Registered User
    Join Date
    11-22-2014
    Location
    US
    MS-Off Ver
    Office 365
    Posts
    83

    Re: Table Consolidation

    Quote Originally Posted by MickG View Post
    Try this , Results sheet2.
    Please Login or Register  to view this content.
    Regards Mick
    Thanks a lot Mick!

    Its working fine for the data that i shared above. But my bad that i missed to include one more thing that is it has to consolidate the same column header data too.

    saf fdg saf hjk
    A 1 2 3 7
    B 65 54 54 21
    A 21 584 54 523
    D 12 42 58 21


    Output:
    saf fdg hjk
    A 79 586 530
    B 119 54 21
    D 70 42 21


    Really sorry for the inconvenience!

  4. #4
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,167

    Re: Table Consolidation

    Hi Sarajun,

    Your problem was why they created Power Query. If you had 2016 Excel, you could do this problem without needing a formula or VBA. Here are the steps.

    Using 2016 Excel
    You would click anywhere on your table of data and click on Data -> From Table and then OK in the range dialog.
    Then right click on "Column1" and "UnPivot Other Columns"
    Then Close and Load to a new sheet.
    Right click anywhere in this new table and Insert -> Pivot Table
    Drag the Column1 to Rows and Attribute to Colums and Value to Values boxes in Pivot List dialog.

    Problem Done!!! No formulas, No VBA. Simply using tools built into Excel (in the newer versions)!!
    See:
    PQ Example for Sarajun.xlsx
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  5. #5
    Registered User
    Join Date
    11-22-2014
    Location
    US
    MS-Off Ver
    Office 365
    Posts
    83

    Re: Table Consolidation

    Quote Originally Posted by MarvinP View Post
    Hi Sarajun,

    Your problem was why they created Power Query. If you had 2016 Excel, you could do this problem without needing a formula or VBA. Here are the steps.

    Using 2016 Excel
    You would click anywhere on your table of data and click on Data -> From Table and then OK in the range dialog.
    Then right click on "Column1" and "UnPivot Other Columns"
    Then Close and Load to a new sheet.
    Right click anywhere in this new table and Insert -> Pivot Table
    Drag the Column1 to Rows and Attribute to Colums and Value to Values boxes in Pivot List dialog.

    Problem Done!!! No formulas, No VBA. Simply using tools built into Excel (in the newer versions)!!
    See:
    Attachment 514861
    Hello Marvin,

    Thank you for the suggestion! I knew about this manual method. But i need a vba solution so that people who don't know much about excel could also use it.

  6. #6
    Forum Expert MickG's Avatar
    Join Date
    11-23-2007
    Location
    Banbury,Oxfordshire
    Posts
    2,650

    Re: Table Consolidation

    Try this:-
    Please Login or Register  to view this content.
    Regards Mick

  7. #7
    Registered User
    Join Date
    11-22-2014
    Location
    US
    MS-Off Ver
    Office 365
    Posts
    83
    Quote Originally Posted by MickG View Post
    Try this:-
    Please Login or Register  to view this content.
    Regards Mick
    It works perfectly! Thanks a lot!!

    If possible can you please explain the code.

  8. #8
    Registered User
    Join Date
    11-22-2014
    Location
    US
    MS-Off Ver
    Office 365
    Posts
    83

    Re: Table Consolidation

    Mick,

    This code works fine for 5 column data but if there are more number of data columns then it doesn't work. I tried to modify the range count but it throws error. Can you please help me on this..

  9. #9
    Registered User
    Join Date
    11-22-2014
    Location
    US
    MS-Off Ver
    Office 365
    Posts
    83

    Re: Table Consolidation

    Quote Originally Posted by sarajun_88 View Post
    Mick,

    This code works fine for 5 column data but if there are more number of data columns then it doesn't work. I tried to modify the range count but it throws error. Can you please help me on this..
    Finally!! got it working.. Thanks a lot!

  10. #10
    Forum Expert MickG's Avatar
    Join Date
    11-23-2007
    Location
    Banbury,Oxfordshire
    Posts
    2,650

    Re: Table Consolidation

    You're welcome

+ 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] Consolidation several tabs' data into a consolidation sheet via a loop?
    By Gti182 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 07-30-2015, 08:18 AM
  2. Multiple Consolidation Pivot Table Help
    By johnsor1 in forum Excel Charting & Pivots
    Replies: 0
    Last Post: 07-21-2015, 10:53 PM
  3. Data Table Consolidation
    By chris.yoder in forum Excel General
    Replies: 0
    Last Post: 05-08-2014, 04:49 PM
  4. Advanced consolidation of rows into table
    By joevan1 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-18-2014, 12:34 AM
  5. Consolidation Piovt table
    By rojan_k in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 04-25-2013, 08:17 AM
  6. Pivot table data consolidation
    By MARKSTRO in forum Excel Charting & Pivots
    Replies: 0
    Last Post: 04-02-2013, 02:44 PM
  7. Pivot Table - Multiple consolidation Range
    By tengreen in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 07-01-2005, 03:05 PM

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