A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
What, no halfpennies or farthings to worry about?
There are several different approaches.
It is possible to create formulas that will work with three £,s,d columns:
TotalD =MOD(SUM(Pence),12)
TotalS =MOD(SUM(Shillings)+INT(SUM(Pence)/12),20)
TotalL =SUM(Pounds)+INT((SUM(Shillings)+INT(SUM(Pence)/12))/20)
Which would do fine for the column totals but would be harder for the row totals as you would have to reference every 3rd cell to get the Pence range, for example.
An alternative would be to use a VBA function to add up £sd strings in single cells and provide the result as an £sd string.
Something like this, assuming the format of the string is £12-1-3
Function AddLSD(R As Range) As String
Dim C As Range
Dim TotPence As Long
For Each C In R.Cells
TotPence = TotPence + LSDToPence(C.Value)
Next
AddLSD = PenceToLSD(TotPence)
End Function
Function LSDToPence(LSD As String) As Long
Dim vParts
Dim Pence As Long
vParts = Split(LSD, "-")
If UBound(vParts) >= 2 Then
If Left(vParts(1), 1) = "£" Then
Pence = 240 * CInt(Mid(vParts(0), 2)) + 12 * vParts(1) + vParts(2)
Else
Pence = 240 * vParts(0) + 12 * vParts(1) + vParts(2)
End If
ElseIf UBound(vParts) >= 1 Then
Pence = 12 * vParts(0) + vParts(1)
ElseIf UBound(vParts) = 1 Then
Pence = vParts(0)
Else
Pence = 0
End If
LSDToPence = Pence
End Function
Function PenceToLSD(Pence As Long) As String
If Pence>=240 Then
PenceToLSD ="£" & Int(Pence/240) & "-" & Int((Pence mod 240)/12) & "-" & (Pence Mod 12)
Else
PenceToLSD = Int(Pence /12) & "-" & (Pence Mod 12)
End If
End Function
Then you can enter your data as £1-19-11 or £0-12-6 in a single cell, omitting the £ is OK, and if no pounds, you can use 12-6 (but that will probably be interpreted as a date if you don't pre-format the cell as text).
And you can use e.g. =AddLSD(B2:B5) to do the addition.