Option Explicit
Function MinIF(CSDL As Range, Ma As String) As Double
Dim WF As Object, J As Long
Set WF = Application.WorksheetFunction
MinIF = WF.Max(CSDL(2).Resize(CSDL.Rows.Count))
For J = 1 To CSDL.Rows.Count
If CSDL.Cells(J, "A").Value = Ma Then
If CSDL.Cells(J, "B").Value < MinIF Then MinIF = CSDL.Cells(J, "B").Value
End If
Next J
End Function
Mã NV | DT | |||
NVH00 | 10 | |||
NHV00 | 13 | |||
NJV00 | 35 | |||
NJV00 | 112 | |||
NVH00 | 122 | |||
NHV00 | 132 | |||
NVH00 | 999 | |||
NHV00 | 987 | |||
NJV00 | 789 |