Here are two User-defined functions for you. ToDecimal takes a value such as
28\18\10 1/2 and returns 24.94375, or 2\10\4 and returns 2.51667 (I have
shown values rounded to 6 places). The second one takes decimal pounds such
as 24.94375 and returns the textual value. Note the backward slash to avoid
Excel thinking about dates - I used regular slash fro halfpenny and
farthing. You could easily change function to work with hyphens.
Send me personal email and I will forward a file with these.
best wishes
Function ToDecimal(lsd) As Double
x = InStr(1, lsd, "\")
pounds = Val(Mid(lsd, 1, x - 1))
y = InStr(x + 1, lsd, "\")
shillings = Val(Mid(lsd, x + 1, 2))
pounds = pounds + shillings / 20
pence = Val(Mid(lsd, y + 1, 2))
pounds = pounds + pence / 240
fraction = Right(lsd, 3)
If fraction = "1/2" Then
pounds = pounds + 0.5 / 240
End If
If fraction = "1/4" Then
pounds = pounds + 0.25 / 240
End If
ToDecimal = pounds
End Function
Function ToLSD(metric)
pounds = Int(metric)
metric = (metric - pounds) * 20
shillings = Int(metric)
metric = (metric - shillings) * 12
pence = Int(metric)
fraction = Application.WorksheetFunction.Round(metric - pence, 2)
If fraction = 0.5 Then
coin = "1/2"
ElseIf fraction = 0.25 Then
coin = "1/4"
End If
ToLSD = pounds & "\" & shillings & "\" & pence & " " & coin
End Function