What I am actually trying to do is create a formula that will capture a stock's gain or loss by referring to the number of shares in a prior month within the same table, and then multiplying that by the price difference between this month and the prior month. I have included what the answer should be in the sample XL2BB table below.
I need to do this on the prior month's shares total because when I receive a dividend, it gets reinvested in more shares, and I don't want to do so on the current month's higher share total because I would be double-counting against a separate income spreadsheet we are keeping. That's why the should-be answer for DUHP is not simply this month's total minus last month's total.
Since I am trying to return a column's value based on lookups of other columns, I tried doing this with XLOOKUP, but since the lookup values and the lookup array are all the exact same columns, I get the #SPILL error. So, if this can be done, I assume it will entail use of a different formula.
Seems self-explanatory, but let me know whether I need to clarify. Thanks.
I need to do this on the prior month's shares total because when I receive a dividend, it gets reinvested in more shares, and I don't want to do so on the current month's higher share total because I would be double-counting against a separate income spreadsheet we are keeping. That's why the should-be answer for DUHP is not simply this month's total minus last month's total.
Since I am trying to return a column's value based on lookups of other columns, I tried doing this with XLOOKUP, but since the lookup values and the lookup array are all the exact same columns, I get the #SPILL error. So, if this can be done, I assume it will entail use of a different formula.
Seems self-explanatory, but let me know whether I need to clarify. Thanks.
Book1 | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
A | B | C | D | E | F | G | H | I | J | |||
1 | Period | Ticker | Shares | Price | Total | Month | Year | M/M G/L | Answer should be | |||
2 | Aug-24 | DRIV | 200 | 22.71 | $ 4,542.00 | 8 | 2024 | |||||
3 | Sep-24 | DRIV | 200 | 23.33 | $ 4,666.00 | 9 | 2024 | $ 124.00 | ||||
4 | Aug-24 | DUHP | 317.9095 | 33.56 | $ 10,669.04 | 8 | 2024 | |||||
5 | Sep-24 | DUHP | 318.8494 | 33.91 | $ 10,812.18 | 9 | 2024 | $ 111.27 | ||||
6 | Aug-24 | EMXC | 73.21556 | 60.66 | $ 4,441.26 | 8 | 2024 | |||||
7 | Sep-24 | EMXC | 73.21556 | 60.71 | $ 4,444.92 | 9 | 2024 | $ 3.66 | ||||
Sheet1 |
Cell Formulas | ||
---|---|---|
Range | Formula | |
F2:F7 | F2 | =MONTH(A2) |
G2:G7 | G2 | =YEAR(A2) |
J3,J7,J5 | J3 | =C2*(D3-D2) |