1
Sub 第一问()
'在K13 返回男性员工的最低工资的姓名
Dim i As Long, minSalary As Double, minName As String
minSalary = 1000000000
For i = 2 To Range("f1").CurrentRegion.Rows.count
If Range("h" & i) = "男" And Range("i" & i) < minSalary Then
minSalary = Range("i" & i)
minName = Range("f" & i)
End If
Next
[k13] = minName
End Sub
'第二问,张三达的工资是第几名
'思路首先拿到张三达的工资,然后假设张三达最高第1名,再和下面的循环对比,如果有比张三达高的
'就给张三达排名加1 ,这样循环结束时,就得到了他的排名
Sub 第二问()
Dim i As Long, rank As Long, salary As Double
For i = 2 To [f1].CurrentRegion.Rows.count
If Range("f" & i) = "张三达" Then
salary = Range("i" & i)