Wednesday, December 09, 2009

 

Calculating National Insurance








Create the cells above and create names for each of the values from the names in the left column.

Two functions are available, one for employee national insurance, one for employer.

The calls are

=NationalInsurance(50000.0,Lower_Earnings_Threshold,Upper_Earnings_Threshold,Class_1,Class_1___4)

=EmployerNationalInsurance(50000.0,Lower_Earnings_Threshold,Class_1___Secondary)

The code for these functions is this


Function NationalInsurance( _
income As Double, _
lowerearnings As Double, _
upperearnings As Double, _
classonerate As Double, _
secondaryrate As Double _
) As Double
NationalInsurance = 0#
If income <= lowerearnings Then
Exit Function
End If
If income <= upperearnings Then
NationalInsurance = (income - lowerearnings) * classonerate
Else
NationalInsurance = (upperearnings - lowerearnings) * classonerate + (income - upperearnings) * secondaryrate
End If
End Function

Function EmployerNationalInsurance( _
income As Double, _
lowerearnings As Double, _
secondaryrate As Double _
) As Double
EmployerNationalInsurance = 0#
If income <= lowerearnings Then
Exit Function
End If
EmployerNationalInsurance = (income - lowerearnings) * secondaryrate
End Function


Comments: Post a Comment





<< Home

This page is powered by Blogger. Isn't yours?

Subscribe to Posts [Atom]