Thread: FORMULA
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
K Dales[_2_] K Dales[_2_] is offline
external usenet poster
 
Posts: 1,163
Default FORMULA

The following assumes you want the results as a text string; if you want an
actual number you could use the Val() function (or VALUE in a worksheet
function):

Public Function AlphaToNum(Alpha As String) As String
Dim UCAlpha As String, i As Integer
AlphaToNum = ""
UCAlpha = UCase(Alpha)
For i = 1 To Len(UCAlpha)
AlphaToNum = AlphaToNum & Asc(Mid(UCAlpha, i, 1)) - 64
Next i
End Function
--
- K Dales


"NAVYCHIEF" wrote:

I need a formula that performs the following:

When the user enters a letter I want a number displayed. i.e. A=1, b=2
etc....

So if the user would enter BAD.......214 would be displayed/returned.