Custom Function to compute versus purchase gains (FIFO).
The passed range should contain exactly three columns of data (in chronological order to preserve first-in/first-out ordering of transactions). The three columns should contain:
- Date can be an actual date or id string (but rows of the range must be chronological).
- Shares is the number of shares purchased (if positive) or sold (if negative).
- Proceeds (in dollars) is the total received from sale (if positive) or paid to purchase (if negative).