Using excel to automatically build a database of stock data
Rate this:
(3/5 from 1 vote)
Hey guys,
I've an excel project that I could use a little help with.
I'm trying to build a spreadsheet that will automatically download stock data and add it to a cummulitive database.
Here's what I want the spreadsheet to do:
1. Download the data (particularly stuff like the PE ratio) at the close of a market day. 2. Add this to the dataset in, say, row one, with the date it was downloaded. 3. Download updated data the next day, at the market close. 4. Add the new numbers to the dataset, but this time in row TWO, without deleting the older data.
I know how to download stock data and how to update it automatically, but I don't know how to do make those downloads cummulitive. Right now, each new download replaces the older data.
I've seen references to the indirect function, but no information on how it's used in this context.
You probably need to find the last cell in the column and then offset 1 down to populate the the row with the new date and price. We can do this in VBA like: VBA Code:
Selection.End(xlDown).Offset(1,0).Select
There is an open source program to download market data for multiple stocks that we developed here. This has a lot of code that might also help with your project.