Function FeesNUSGE(Holdings As Double) As Double
Dim i As Integer
Dim FeeTable1 As Variant
FeeTable1 = [NUSGE] 'range name of area holding the table
FeesNUSGE = 0
For i = 2 To UBound(FeeTable1, 1) - 1
If Holdings >= FeeTable1(i, 1) Then
If Holdings > FeeTable1(i + 1, 1) Then
FeesNUSGE = FeesNUSGE + (FeeTable1(i + 1, 1) - FeeTable1(i, 1)) * FeeTable1(i, 2)
Else
FeesNUSGE = FeesNUSGE + (Holdings - FeeTable1(i, 1)) * FeeTable1(i, 2)
End If
End If
Next
If Holdings > FeeTable1(UBound(FeeTable1, 1), 1) Then
FeesNUSGE = FeesNUSGE + (Holdings - FeeTable1(UBound(FeeTable1, 1), 1)) * FeeTable1(UBound(FeeTable1, 1), 2)
End If
End Function
Function FeesAWEQ(Holdings As Double) As Double
Dim i As Integer
Dim FeeTable2 As Variant
FeeTable2 = [AWEQ] 'range name of area holding the table
FeesAWEQ = 0
For i = 2 To UBound(FeeTable2, 1) - 1
If Holdings >= FeeTable2(i, 1) Then
If Holdings > FeeTable2(i + 1, 1) Then
FeesAWEQ = FeesAWEQ + (FeeTable2(i + 1, 1) - FeeTable2(i, 1)) * FeeTable2(i, 2)
Else
FeesAWEQ = FeesAWEQ + (Holdings - FeeTable2(i, 1)) * FeeTable2(i, 2)
End If
End If
Next
If Holdings > FeeTable2(UBound(FeeTable2, 1), 1) Then
FeesAWEQ = FeesAWEQ + (Holdings - FeeTable2(UBound(FeeTable2, 1), 1)) * FeeTable2(UBound(FeeTable2, 1), 2)
End If
End Function
Function FeesWDIVG(Holdings As Double) As Double
Dim i As Integer
Dim FeeTable3 As Variant
FeeTable3 = [WDIVG] 'range name of area holding the table
FeesWDIVG = 0
For i = 2 To UBound(FeeTable3, 1) - 1
If Holdings >= FeeTable3(i, 1) Then
If Holdings > FeeTable3(i + 1, 1) Then
FeesWDIVG = FeesWDIVG + (FeeTable3(i + 1, 1) - FeeTable3(i, 1)) * FeeTable3(i, 2)
Else
FeesWDIVG = FeesWDIVG + (Holdings - FeeTable3(i, 1)) * FeeTable3(i, 2)
End If
End If
Next
If Holdings > FeeTable3(UBound(FeeTable3, 1), 1) Then
FeesWDIVG = FeesWDIVG + (Holdings - FeeTable3(UBound(FeeTable3, 1), 1)) * FeeTable3(UBound(FeeTable3, 1), 2)
End If
End Function