Noname > 10-09-19, 06:54 PM
Function Mycase(v As Variant, C As Range, R As Range)
Dim canduoi, cantren
lastrow = C.Cells.Rows.Count
For k = 1 To lastrow
s = C.Cells(k, 1).Value
If InStr(s, "<") > 0 Then
canduoi = 0
cantren = Val(Right(s, Len(s) - InStr(s, "<") - 1)) - 0.000001 ElseIf InStr(s, ">") > 0 Then
canduoi = Val(Right(s, Len(s) - InStr(s, ">") - 1)) + 0.000001
cantren = canduoi + v
Else
canduoi = Val(Left(s, InStr(s, "-") - 1))
cantren = Val(Mid(s, InStr(s, "-") + 2))
End If
If v >= canduoi And v <= cantren Then Mycase = R.Cells(k, 1)
Exit Function
End If
Next
End Function
ongke0711 > 11-09-19, 01:32 AM
CanTren = CanDuoi + v