excel VBA if语句的使用
发布网友
发布时间:2022-04-26 18:59
我来回答
共2个回答
热心网友
时间:2023-10-22 08:15
Function Bonus(performance, salary)
If performance = 1 Then
Bonus = salary * 0.1
ElseIf performance = 2 Then
Bonus = salary * 0.09
ElseIf performance = 3 Then
Bonus = salary * 0.07
Else
Bonus = 0
End If
End Function
请参考,if和then之前是条件,Bonus = salary * 0.1为符合条件下的操作
热心网友
时间:2023-10-22 08:15
Sub s()
Dim i&, t$
i = 1
t = Cells(i, 1).Text
Do While t <> ""
If InStr(t, "市") Then
Cells(i, 2) = 1
ElseIf InStr(t, "省") Then
Cells(i, 2) = 2
Else
Cells(i, 2) = 0
End If
i = i + 1
t = Cells(i, 1).Text
Loop
End Sub