+ Reply to Thread
Results 1 to 7 of 7

consolidating table data

  1. #1
    Forum Contributor
    Join Date
    12-03-2008
    Location
    Key West, FL
    MS-Off Ver
    365 Apps for Enterprise
    Posts
    665

    consolidating table data

    I use a multi-tab workbook which calculates stock trades. One of its tabs is a "trade list" which looks like the first tab on the attached workbook.

    The first challenge is to remove rows which have no activity. I think I could probably fix that problem using a pivot table (although I've never mastered these. If the data in my main workbook changes, will the pivot table change accordingly?)

    The more complex challenge for me is that I need to reformat the trade list so that it looks like the one on the second tab. In the second tab, a single row will include both the opening and closing info. for each trade. (e.g. date, price, ticker, volume, profit)

    Sometimes, the trading strategy will open two trades on different dates, then close both of them out on another day. This is what you'll see with the first trade.

    So... How do I match a trade's closing data to a trade's opening data so that it looks like the second tab? (I've manually plugged in about 6 trades so you can see where I got the data from on the first tab). Could I assign a unique number to each trade as a "helper"? (and how would I do that?)

    Note that the example worksheet uses color to indicate each full trade.

    Please let me know if I need to clarify anything! I very much appreciate your help.

    EDIT: I've marked this thread as "solved" because I'm going to post a similar thread in the commercial forum.
    Attached Files Attached Files
    Last edited by jrtaylor; 08-05-2017 at 06:59 PM.

  2. #2
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    43,998

    Re: consolidating table data

    How many rows (maximum) are there in raw data?
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  3. #3
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,641

    Re: consolidating table data

    If it's the same workbook as the one referred to in other threads, then it's large and there are already speed issues, so a formula solution probably won't be appropriate.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  4. #4
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: consolidating table data

    You can try this code to rearange the data in a table.

    After that you can use (e.g.) a pivot table to analyse the data.

    Please Login or Register  to view this content.
    Notice my main language is not English.

    I appreciate it, if you reply on my solution.

    If you are satisfied with the solution, please mark the question solved.

    You can add reputation by clicking on the star * add reputation.

  5. #5
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    43,998

    Re: consolidating table data

    I can do this with a formula easily enough... but it's all down to array formulae, so it probably won't work for huge datasets.

    Edit: scrub that idea... fatally flawed...
    Last edited by Glenn Kennedy; 08-05-2017 at 04:33 AM.

  6. #6
    Forum Contributor
    Join Date
    12-03-2008
    Location
    Key West, FL
    MS-Off Ver
    365 Apps for Enterprise
    Posts
    665

    Re: consolidating table data

    Hi everyone, thanks for looking at this. Oeldere, I'll try your code and reply once I've run it.

    I think its ok to leave this thread open until I've had a chance to test the code?

    PS Glenn, I'll have multiple trade lists, and the number of rows will vary probably between 700 and 2500.

    Again, thank you!
    Last edited by jrtaylor; 08-05-2017 at 09:37 AM.

  7. #7
    Forum Contributor
    Join Date
    12-03-2008
    Location
    Key West, FL
    MS-Off Ver
    365 Apps for Enterprise
    Posts
    665

    Re: consolidating table data

    Hi Oeldere

    Its been a long time since I recorded or ran a macro. I copied/pasted your code into a blank module and made the following changes to it: (renamed it, then substituted the names of the worksheets for the lines beginning with Set mr


    It did create the table headings in my "Output" sheet, but there was no data beneath it.

    Currently my source sheet ("Trades") has some unrelated data in the first 16 rows. Could that be the problem?

    Or did I need to make any other changes to the code?

    Thanks!


    Please Login or Register  to view this content.

+ 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. Replies: 1
    Last Post: 06-02-2016, 01:58 PM
  2. Consolidating Data From a Table to a Graph
    By kfridell in forum Excel General
    Replies: 2
    Last Post: 05-25-2016, 07:23 PM
  3. Consolidating and converting table data - Help!
    By forbzinator in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-20-2014, 10:46 AM
  4. Consolidating many tables from one sheet to a master table including all the data
    By Michell Feitosa in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 06-05-2014, 09:29 AM
  5. Consolidating data with a chart or pivot table
    By ehitt in forum Excel Charting & Pivots
    Replies: 0
    Last Post: 09-24-2013, 11:08 PM
  6. Consolidating data for pivot table
    By floricita in forum Excel General
    Replies: 0
    Last Post: 09-01-2010, 09:03 AM
  7. Consolidating data in one Pivot Table.
    By Kianuz in forum Excel General
    Replies: 2
    Last Post: 10-23-2009, 10:24 AM

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