The issue: I want to calculate weekly returns as follows: (Price in week 't' + Dividends paid during the week)/Price in Week 't-1'. Basically, this is a simple weekly return. In order to get this, I need to add any dividends paid during the week to end of week's stock price. For example, if you focus on permno 10001 and date of 19890911 there is a dividend of $0.0416 paid. The weekly return for the week ending 19890915 should then be calculated as (3 + 0.0416)/3.083 The 3 in the numerator is the price on 19890915. The 3 in the denominator is the price on prior week 19890908. The issue is we cannot do this manually. The dataset has has more than 25 million observations. I tried wirting a macro and it works. However, my system crashes because the macro needs to run about 95,000 times and at the rate of 5 seconds per run, it takes more than 130 hours to run. Any thoughts? If you find a solution (preferably code, if not a step-wise logic and solution in excel will do), I will count this towards one week's assignment score (75 points). If you plan to work on this, as I always say, focus on getting the code right for one company and then we can apply it to others. The dataset with one company is named Temp. The file with 25 million observations is attached as a zip file in case you want to work on it.
... View more