+ Reply to Thread
Results 1 to 5 of 5

Thread: reading in array to use in calculation

  1. #1
    Registered User
    Join Date
    05-25-2011
    Location
    Pennsylvania, USA
    MS-Off Ver
    Excel 2007
    Posts
    20

    reading in array to use in calculation

    Alright, so here's what I'm trying to do:
    I have a table that is 10 columns and 24 rows. It has percents in it. I need to create some tables farther down that are the same size that multiplies the percents in the first table by a certain value for each row of the new table. If it makes it easier to understand the first table stretches from column D1 to M24. Then for every table farther down in the same sheet there will be numbers in column C. Let's say that In D1 is 5% and in C 101 (new table) there is 1000. Then D101 would be .05*1000.

    In order to do this I wanted to read in the intial table as an array and store it. Then multiply the array by the values in column C for each table and paste the values into the table.

    Let me know if this is unclear. I appreaciate the help.

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & read 2007
    Posts
    15,979

    Re: reading in array to use in calculation

    Hello gryffin13,

    To better illustrate your problem, you should post your workbook with both before and after examples of the data. Having the workbook greatly reduces coding time and produces solutions that work correctly.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Registered User
    Join Date
    05-25-2011
    Location
    Pennsylvania, USA
    MS-Off Ver
    Excel 2007
    Posts
    20

    Re: reading in array to use in calculation

    Ok here is my workbook. The first section is a "before" and the second is the "after". Obviously this is easy to do manually with formulas. This is more of a challenge to myself as a beginner to vba. Does this help make things clearer?
    Attached Files Attached Files

  4. #4
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & read 2007
    Posts
    15,979

    Re: reading in array to use in calculation

    Hello gryffin13,

    The percentage tables are 25 rows by 10 columns and have 3 blank rows. Presumably if there is a one to one correspondence between the percentage table and new table then how do you want to handle the empty cells when multiplying the values?
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  5. #5
    Registered User
    Join Date
    05-25-2011
    Location
    Pennsylvania, USA
    MS-Off Ver
    Excel 2007
    Posts
    20

    Re: reading in array to use in calculation

    That was an oversight on my part. The bottom row of the percent tables (it's over 100% for most of them) should just be deleted. Sorry.
    And as for empty cells, it can be treated as a 0. Then when it's multiplied by anything it will still be zero.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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.2.0