+ Reply to Thread
Results 1 to 6 of 6

need array assistance for database sorting

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

    need array assistance for database sorting

    I am attaching a worksheet which shows what I would like to see. I am having difficulty writing the formula.

    The database I have is a list of forex trades. Each trade is made at a specific time, and involves a specific currency pair (such as EURUSD).

    I want to summarize the trades in a table which sums up a week's trades for each pair. (see worksheet).

    Can anyone help? Thanks!
    Attached Files Attached Files
    Last edited by jrtaylor; 02-20-2009 at 07:12 PM.

  2. #2
    Valued Forum Contributor Richard Schollar's Avatar
    Join Date
    05-23-2006
    Location
    Hampshire UK
    MS-Off Ver
    Excel 2002
    Posts
    1,264

    Re: need array assistance for database sorting

    Hi

    You can use a pivot table for this (see attached). The trick is in getting your dates to group by every seven days. Please see the following link for how to use pivot tables:

    http://peltiertech.com/Excel/Pivots/pivotstart.htm

    Richard
    Attached Files Attached Files
    Richard Schollar
    Microsoft MVP - Excel

  3. #3
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: need array assistance for database sorting

    I agree with Richard that a PT is the way to go though a PT won't show currency pairs that don't exist in your db (eg AUDJPY)
    (Note: you could create dummy records (0) for each pair to rectify this)

    Alternative approach given you're using 2007 is to use SUMIFS to generate your table:

    Please Login or Register  to view this content.
    (Note the numbers generated differ from your ex. given I think you have recorded the 80 EURUSD on 9th Feb in the wrong row in your sample)

    Pre XL2007 you'd have to use arrays like Sumproduct which if used repeatedly are normally best avoided.
    Last edited by DonkeyOte; 02-15-2009 at 07:00 AM.

  4. #4
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: need array assistance for database sorting

    Also, for the manual table you could use the below to generate your week list:

    Please Login or Register  to view this content.

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

    Re: need array assistance for database sorting

    Richard and Donkey, thank you for your help. I should have noted that the database changes on a daily basis (it adds new rows). I'll try your suggestions and let you know if I'm successful.

  6. #6
    Valued Forum Contributor Richard Schollar's Avatar
    Join Date
    05-23-2006
    Location
    Hampshire UK
    MS-Off Ver
    Excel 2002
    Posts
    1,264

    Re: need array assistance for database sorting

    If the database size changes then if using a pivot table you want to ensure that you define a named range to hold the database data (this is so that the Grouping feature works consistently). If you are using xl2003 or xl2007 then you have another option which is to specify the data range is a List (xl2003) or a Table (xl2007) - these will expand and contract as data is added or deleted.

    For information on Dynamic Named Ranges (which expand or contract as data is added/deleted) which is what you want (unless using a List/Table) see the following link:

    http://www.contextures.com/xlNames01.html#Dynamic

    Richard

+ 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