VBA Array Transformation Question

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

jaykojc

Thread Starter
Joined
Apr 30, 2012
Messages
20
I very often get two dimensional arrays of returns for a given fund, months across the top and years down the left side:
Jan Feb ... Dec
2019 1% 2% 1%
2020 2% 1% 3%

This format is useless to perform analysis, so I will typically convert it to a single dimension array:

1/31/2019 1%
2/28/2019 2%
Etc.

I am trying to write a VBA script to take this two dimensional data and convert it in a relatively automated way into the second format displayed.

To my mind, the simplest way to do this would be to create three variables: two dates and one array. Find the first data point (IE the first RC with actual data), then finding the month and year associated with that data. Do the same for the last data point. Create a second array and just loop through all the available data and put it in order. Then output the array in a column and loop through the dates.

Am I reinventing the wheel here or otherwise being wildly inefficient?
 
Joined
Sep 4, 2003
Messages
4,916
When you say "array" are you talking about data in an Excel Spreadsheet that is spread across multiple columns and rows or are you talking about a true code array that is being populated programmatically from the results of a database query?
 
Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 807,865 other people just like you!

Latest posts

Staff online

Top