Try a Case select method
Function Convert(ByVal Value As String) As Integer Select Case Value Case "A" Convert = 10 Case "B" Convert = 11 Case "C" Convert = 12 Case "D" Convert = 13 Case "E" Convert = 14 Case "F" Convert = 15 Case Else ' Assuming Value should be converted to an integer if it's not A-F ' You might want to add error handling here if Value isn't always a valid number If IsNumeric(Value) Then Convert = CInt(Value) Else ' Handle the case where Value is not A-F and not a number ' For example: Convert = 0 ' Or raise an error, or return a specific error code End If End Select End Function