| 网站首页 | 业界新闻 | 小组 | 交易 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
 买学问 - 大牛一对一辅导，有问必答 买学问 - 专业的付费知识问答平台

已结贴   问题点数：5  回复次数：3
【提问】这个工资怎么用函数计算？？？

得分:5

得分:0

得分:0

Function SetMoneyToWorker(ByVal rng As Range, ByVal Target As Range) As Double
Dim dValue As Double
Dim sName As String
Dim i, s As Integer
sName = rng.Value
Dim strNoThing As String
Dim rowCount As Integer
rowCount = Target.Rows.Count
dValue = 0
strNoThing = "无"
For i = 1 To rowCount

If Target.Cells(i, 1) = sName Then
If Target.Cells(i, 2) = strNoThing And Target.Cells(i, 3) = strNoThing Then
dValue = dValue + Target.Cells(i, 4)
ElseIf Target.Cells(i, 2) <> strNoThing And Target.Cells(i, 3) = strNoThing Then
dValue = dValue + Target.Cells(i, 4) * 0.55
ElseIf Target.Cells(i, 2) <> strNoThing And Target.Cells(i, 3) <> strNoThing Then
dValue = dValue + Target.Cells(i, 4) * 0.5
End If
End If
If Target.Cells(i, 2) = sName Then
If Target.Cells(i, 3) = strNoThing Then
dValue = dValue + Target.Cells(i, 4) * 0.45
Else
dValue = dValue + Target.Cells(i, 4) * 0.3
End If
End If
If Target.Cells(i, 3) = sName Then
dValue = dValue + Target.Cells(i, 4) * 0.2
End If

Next
SetMoneyToWorker = Format(dValue, "0.00")
End Function
@xyxcc177 能用中文注释每一个语句的中文意思吗？

[此贴子已经被作者于2018-12-20 18:59编辑过]

• 4
• 1/1页
• 1