0
以下の関数を作成し、Excelから呼び出すときは=ratingper(b7,u7)
と書いてください。 #NAME?が返されます。%age(.15)のような値を返すExcel-VBA関数
Function RATINGPER(pvar As String, svar As Double) As Double
If (svar < 20001 And pvar = "A") Then
RATINGPER = 0.16
ElseIf (svar < 20001 And pvar = "B") Then
RATINGPER = 0.14
ElseIf (svar < 20001 And pvar = "C") Then
RATINGPER = 0.12
ElseIf (svar >= 20001 And svar < 30001 And pvar = "A") Then
RATINGPER = 0.15
ElseIf (svar >= 20001 And svar < 30001 And pvar = "B") Then
RATINGPER = 0.11
ElseIf (svar >= 20001 And svar < 30001 And pvar = "C") Then
RATINGPER = 0.9
ElseIf (svar >= 30001 And svar < 55001 And pvar = "A") Then
RATINGPER = 0.13
ElseIf (svar >= 30001 And svar < 55001 And pvar = "B") Then
RATINGPER = 0.9
ElseIf (svar >= 30001 And svar < 55001 And pvar = "C") Then
RATINGPER = 0.7
ElseIf (svar >= 55001 And pvar = "A") Then
RATINGPER = 0.11
ElseIf (svar >= 55001 And pvar = B) Then
RATINGPER = 0.9
ElseIf (svar >= 55001 And pvar = "C") Then
RATINGPER = 0.7
Else
RATINGPER = 0
End If
End Function
[Excelセル(2010)からVBA関数を呼び出す方法?](http://stackoverflow.com/questions/12351339/how-to-call-vba-function-from-excel-cells-2010) ) – cxw