+ Reply to Thread
Results 1 to 4 of 4

Whats the best approach working with data, Arrays/Collections/other?

  1. #1
    Registered User
    Join Date
    03-23-2011
    Location
    West Bromwich, England
    MS-Off Ver
    Excel 2007 & 2013 in Azure
    Posts
    83

    Whats the best approach working with data, Arrays/Collections/other?

    Hi All,

    At this time, I'm looking for guidance rather than solving an issue with specific code.

    I am developing using arrays, but am just checking if this is the best approach or whether I should use another (eg collections, temp tables etc). The limitations, basic info and thoughts as to how to approach this is as follows:

    Limitations:
    1. I must use Excel to convert a system report (which always has the same structure) into an csv file to upload into another system. I cannot used MS Access etc as the end users only have Excel.
    2. I have no access to the source system and no control over the structure of the source report.
    3. I have no control over the structure of the final csv output, as is used to create invoices etc in the destination system.

    Basic Info:
    1. The source report has a Site ID in column 1. On separate rows below but in other columns there are dates 8 totals (4 Quantities & 4 values), with a subtotal for the site in the last row. (this would all make 1 document)
    2. There are 3 excel tables (report parameters, site parameters & VAT parameters) which the user maintains and determine what is required.
    3. The CSV output has 12 columns, some of which are of mixed data types, but are the same by line/row type.
    4. There are 4 different line/row types that can be created (Header, text, invoice, collections), which are created as follows:
    Headers - 1 row for each Site ID
    Text - 3 rows for each Site ID
    Invoice - 1 to 4 rows based on the 8 totals (1 qty & 1 value make 1 item), where value <> 0.
    Collections - 0 to 4 rows based on whether cash has been collected for the relevant invoice (identified from Site Parameters)
    5. There are several other possible variations on what happens based on the parameters (eg 1 or multiple invoices per document, itemised or consolidated totals) etc, which makes this more complex but no need to go into detail as hopefully this is enough to understand the concept.

    My thoughts to approach this are with arrays:
    1. 3 to store the parameters
    2. 1 to store headers (with a doc id to link across arrays)
    3. 1 to store text lines (with a doc id to link across arrays)
    4. 1 temp array to build site totals by the 4 itemised (1 = quantity & value) subtotals (not needed by week dates)
    5. loop through temp array, do stuff as per parameters, then store invoices in 1 array & collections in another.
    6. loop through headers, pull in related texts, invoices then collections (output must be in that order) into final array
    7. Output final array to CSV (via application.transpose).

    I'm relatively happy doing the above, though not an expect so my code won't be the most efficient and may be longer than needed (I'll end up using 1 x 1D array and 8 x multi-dimensional arrays). So I am looking to see if there are any suggestions for a better approach (rather than 'oh yeah that will work', as would like to find the best approach & learn to improve my knowledge). A simple pointer will suffice so I can then follow up and learn from there.

    Thanks in advance

    Tooley

  2. #2
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,957

    Re: Whats the best approach working with data, Arrays/Collections/other?

    FYI: your end users can have Access. Microsoft provides free, runtime-only licenses for Access. This will allow the possessors of these licenses to run whatever is developed for them. They will be able to do data entry and run reports that are developed for them. They can not modify anything which is probably what you want anyway.

    However, if you still wish to press on with an Excel solution, it would help us a lot to help you if you attach a workbook with sample non-sensitive data.
    One spreadsheet to rule them all. One spreadsheet to find them. One spreadsheet to bring them all and at corporate, bind them.

    A picture is worth a thousand words, but a sample spreadsheet is more likely to be worked on.

  3. #3
    Registered User
    Join Date
    03-23-2011
    Location
    West Bromwich, England
    MS-Off Ver
    Excel 2007 & 2013 in Azure
    Posts
    83

    Re: Whats the best approach working with data, Arrays/Collections/other?

    Thanks dflak. Unfortunately, whilst using a relational database like Access would have been my preferred option, this option was refused by my employer as is against policy.

    I've completed now. In summary, I populated a single string array with the data needed from the source data together with the relevant site parameters. I copied report parameters to global dimensions rather than another array, simply to make the code easier to read. From there, the code loops through the array, performs the necessary actions and calculations passing results to a second string array then transposes the array to a csv file.

    Thanks again

  4. #4
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,957

    Re: Whats the best approach working with data, Arrays/Collections/other?

    That's management for you: "I want you to nail those two boards together. Here's your screwdriver. Get to work."

+ 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. Arrays and Collections and Dictionaries oh my
    By JYTS in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 12-24-2015, 12:06 AM
  2. [SOLVED] Help for v-lookup approach instead of manually cell linking approach - Excel 2010
    By Mirisage in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 05-31-2013, 01:32 PM
  3. Collections within class module collections
    By AndyLitch in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-14-2013, 06:00 AM
  4. cumulative monthly figures - whats the best approach??
    By marcia21 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-27-2008, 05:14 AM
  5. Trouble with Arrays / Collections
    By John in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 09-07-2005, 03:05 PM
  6. [SOLVED] VBA - Collections/Arrays/Sorting
    By William Benson in forum Excel General
    Replies: 5
    Last Post: 05-31-2005, 10:05 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