+ Reply to Thread
Results 1 to 8 of 8

VBA for Transforming Tables

  1. #1
    Forum Contributor
    Join Date
    12-19-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    113

    VBA for Transforming Tables

    I need help to transform the attached table: original data in column A-D and example of desired outcome in column F-G.

    Thanks for help
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    10-02-2014
    Location
    USA
    MS-Off Ver
    2016
    Posts
    1,222

    Re: VBA for Transforming Tables

    See my post here. Its possible to do this with a formula. It would likely be easier to update and fix, alter, etc. In addition you would not need to save as xlsm and no one would need to enable macros to use it.

    Ill see if I can add a response here with the formulas updated to your needs.

  3. #3
    Forum Expert
    Join Date
    10-02-2014
    Location
    USA
    MS-Off Ver
    2016
    Posts
    1,222

    Re: VBA for Transforming Tables

    Hell, I may have found a simpler way to do it, at least in your case. I have attached my efforts, but I will explain what I did as well.

    In I1 i did (filled down):

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    This gives use the headers repeating filled down G1,G2,G3,G4,G1,G2,G3,G4...

    Then in J1 (filled down):

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    This essentially starts at the first time under the proper header and increments down the list according to the count of that header in Column I from the start (J1) to J whatever the current row is.

    You will have to fill these as far down as required to complete the sequence, after which you will likely get blanks (or whatever you have typed under your table). You can see in my sample it start bringing in ---- and then 0's. The headers will just alternate til the end of time (as far down as you fill them).

    Hope this helps.
    Attached Files Attached Files

  4. #4
    Forum Contributor
    Join Date
    12-19-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    113

    Re: VBA for Transforming Tables

    My problem is not solved using your suggestion. I need to keep all records in that order as shown in my original data sample. It should be a VBA to it rather than using formula. Thanks for your help.

  5. #5
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,882

    Re: VBA for Transforming Tables

    try this

    Please Login or Register  to view this content.
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  6. #6
    Forum Expert
    Join Date
    10-02-2014
    Location
    USA
    MS-Off Ver
    2016
    Posts
    1,222

    Re: VBA for Transforming Tables

    Quote Originally Posted by Ucpaul View Post
    My problem is not solved using your suggestion. I need to keep all records in that order as shown in my original data sample. It should be a VBA to it rather than using formula. Thanks for your help.
    Not sure I follow your explanation of how it doesn't work. My results look like this:

    Capture.PNG

    My results match yours exactly Columns I:J are identical in content to F:G, minus the formatting which could simply be done as a conditional format. If you have your heart set on a macro, thats fine...but I dont see where this isnt producing the same results as your sample.

  7. #7
    Forum Contributor
    Join Date
    12-19-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    113

    Re: VBA for Transforming Tables

    Yes, you're right. Sorry that I opened the file from your previous post (not this one). Your formula works! Thanks for help

  8. #8
    Forum Contributor
    Join Date
    12-19-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    113

    Re: VBA for Transforming Tables

    This Macro is perfect!. Thanks for help

+ 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. Transforming table forms. Pivor Tables does not work as expected.
    By nikola2004mkd in forum Excel Charting & Pivots
    Replies: 3
    Last Post: 07-07-2017, 08:12 AM
  2. transforming rows & columns
    By koen303 in forum Excel General
    Replies: 5
    Last Post: 02-26-2015, 05:01 AM
  3. [SOLVED] Transforming output into a new sheet
    By exlecel123 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-05-2013, 11:09 AM
  4. Transforming data to lie between 0 and 1
    By zgall1 in forum Excel General
    Replies: 2
    Last Post: 03-20-2010, 06:40 PM
  5. Text Transforming? Could really use a minute of help...
    By bodegas411 in forum Excel General
    Replies: 8
    Last Post: 06-20-2007, 10:10 PM
  6. [SOLVED] transforming a date
    By [email protected] in forum Excel General
    Replies: 4
    Last Post: 08-01-2006, 12:15 PM
  7. Transforming Data
    By Murtaza in forum Excel General
    Replies: 4
    Last Post: 08-23-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