CÁc anh chị vui lòng giúp đỡ xem hàm này bị sai ở chỗ nào mà hiễn lỗi #value!. cám ơn nhiều
Function tiennuoc2011(dm As Integer, sd As Integer, loai As String)
If loai <> "" Then
tt = sd * 15525
tiennuoc2011 = tt
ElseIf loai = "" Then
If sd <= dm Then
tt = sd * 5060
tiennuoc2011 = tt
ElseIf (sd > dm) And (sd - dm - ((dm / 4) * 2)) < 0 Then
tt = (dm * 5060) + ((sd - dm) * 9545)
tiennuoc2011 = tt
ElseIf sd > dm Then
tt = (dm * 5060) + (((dm / 4) * 2) * 9545) + ((sd - dm - ((dm / 4) * 2)) * 12075)
tiennuoc2011 = tt
End If
End If
End Function
Function tiennuoc2011(dm As Integer, sd As Integer, loai As String)
If loai <> "" Then
tt = sd * 15525
tiennuoc2011 = tt
ElseIf loai = "" Then
If sd <= dm Then
tt = sd * 5060
tiennuoc2011 = tt
ElseIf (sd > dm) And (sd - dm - ((dm / 4) * 2)) < 0 Then
tt = (dm * 5060) + ((sd - dm) * 9545)
tiennuoc2011 = tt
ElseIf sd > dm Then
tt = (dm * 5060) + (((dm / 4) * 2) * 9545) + ((sd - dm - ((dm / 4) * 2)) * 12075)
tiennuoc2011 = tt
End If
End If
End Function