 This topic has 0 replies, 1 voice, and was last updated 7 months ago by Richard Purvey.

AuthorPosts

March 12, 2024 at 3:24 pm #24954
Actuarial Life and Death: How to write a spreadsheet to calculate a joint life type APV based on inputted life tables
The sheet does not use any commutation functions, recursion formulae or approximations, it calculates exactly.
It is a thirteen column sheet (columns A to M), with the first four columns (columns A to D) accommodating the input of the values for x, y, n and v respectively, columns E, F, G and H accommodating the input of the life tables, and the last column (column M) displaying the calculated joint life type APV, namely;
APV of an nyear temporary life annuity due, with a discount factor of v, of 1 per year payable once a year while both (x) and (y) are alive
HOW TO WRITE THE SHEET
COLUMNS A TO D
Put the headings x, y, n and v into cells A1, B1, C1 and D1 respectively, and then input the values for x, y, n and v into cells A2, B2, C2 and D2 respectively.
COLUMN E
Put the heading, x values, into cell E1, and then input the x values, in ascending order, down column E, starting by inputting the lowest x value into cell E2
COLUMN F
Put the heading, lx values, into cell F1, and then input the lx values, in descending order, down column F, starting by inputting the highest lx value into cell F2
COLUMN G
Put the heading, y values, into cell G1, and then input the y values, in ascending order, down column G, starting by inputting the lowest y value into cell G2
COLUMN H
Put the heading, ly values, into cell H1, and then input the ly values, in descending order, down column H, starting by inputting the highest ly value into cell H2
COLUMN I
Put the heading, r, into cell I1, then put the value, 0, into cell I2, then input the formulae, =I2+1 into cell I3 and then copy this formula down to, and including, cell I300
COLUMN J
Put the heading, v^rl(x+r) list for APV calc, into cell J1, then input the formula, =IF(I2<$C$2,$D$2^I2*LOOKUP($A$2+I2,$E$2:$E$300,$F$2:$F$300),0) into cell J2 and then copy this formula down to, and including, cell J300
COLUMN K
Put the heading, l(y+r) list for APV calc, into cell K1, then input the formula, =IF(I2<$C$2,LOOKUP($B$2+I2,$G$2:$G$300,$H$2:$H$300),0) into cell K2 and then copy this formula down to, and including, cell K300
COLUMN L
Put the heading, v^rl(x+r)l(y+r) list for APV calc, into cell L1, then input the formula, =J2*K2 into cell L2 and then copy this formula down to, and including, cell L300
COLUMN M
Put the heading, APV, into cell M1, then input the formula, =SUM(L2:L300)/(LOOKUP(A2,E2:E300,F2:F300)*LOOKUP(B2,G2:G300,H2:H300)) into cell M2
You now have a spreadsheet to calculate a joint life type APV based on inputted values for x, y, n and v and inputted life tables!
An additional note (optional read)
To utilise your spreadsheet to calculate and display the joint life type APV for x=z,z+1,…h, with y being related to x through a formula such as y=x or y=x+10, etc, follow the four steps below;
STEP 1
Input whatever formula is needed into cell B2 (for example, =A2 or =A2+10, etc) along with the values for n and v, as well as the life tables, but don’t put in a value for x
STEP 2
Now put the value for z into cell A3, then input the formula, =A3+1 into cell A4 and then copy this formula down to, and including, the column A cell in which the value for h appears, noting this row number.
STEP 3
Now enter the following Visual Basic code into Excel’s Visual Basic facility, replacing R with the row number of the row in which the value for h appeared;
Sub Macro1()
‘
‘ Macro1 Macro
‘
‘
For i = 3 To R
Range(“A” & i).Select
Selection.Copy
Range(“A2”).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range(“M2”).Select
Application.CutCopyMode = False
Selection.Copy
Range(“M” & i).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Next i
End Sub
STEP 4
Now run this Visual Basic code.
The column M cells in row 3 down to, and including, the row in which the value for h appeared, now show the joint life type APV for x=z,z+1,…h
NOTE: If you now want the spreadsheet to calculate and display the joint life type APV, using the same life tables and the same values for z and h as before, but using a different formula in cell B2 and/or a different value(s) for n and/or v, then simply; delete what’s in the column M cells in row 3 downwards, then delete what’s in cell A2, then make your change to the formula in cell B2 and/or the value(s) for n and/or v and then run the existing Visual Basic code again.
There you have it!
Richard Purvey March 2024

AuthorPosts
 You must be logged in to reply to this topic.