You are here:

Advertisement

hi tom

tom i created one code below pls check

royalkings

1234567890

where r=1, o=2, y=3 and so on....

Now what i need is when i type text in A1

for example lklg that means 5659 in numeric

language. I want this coz i want to keep the

price in tex format. Now suppose i type

royal in A1 then B1 should show 12345 the

numeric value of royal. TOM provide with formula

or macro or both. Pls ASAP

Tnx

Sabah

Sabah,

you can put his in a general module in your workbook (insert=>Module in the VBE)

then you can put this in a cell

=GetScore(A1) for example.

Public Function GetScore(r As Range) As Variant

Dim i As Long, j As Long

Dim s As String, s1 As String, s2 As String

Dim s3 As String, v1 As Variant

Dim v(1 To 10) As Long

For i = 1 To 10

If i = 10 Then

v(i) = 0

Else

v(i) = i

End If

Next

If r Is Nothing Then

GetScore = CVErr(xlErrRef)

ElseIf r.Count > 1 Then

GetScore = CVErr(xlErrValue)

ElseIf Len(r.Text) = 0 Then

GetScore = CVErr(xlErrValue)

Else

s = UCase("royalkings")

s1 = r.Text

s2 = ""

For j = 1 To Len(s1)

s3 = UCase(Mid(s1, j, 1))

v1 = Empty

v1 = Application.Search(s3, s)

' Debug.Print s3, v(v1)

If Not IsError(v1) Then

s2 = s2 & Format(v(v1), "@")

End If

Next

End If

GetScore = s2

End Function

I don't think there is single or nested function that will do this.

--

regards,

Tom Ogilvy

This topic answers questions related to Microsoft Excel spreadsheet (or workbook) stand-alone or Mircrosoft Office Excel including Excel 2003, Excel 2007, Office 2000, and Office XP. You can get Excel help on Excel formulas(or functions), Excell macros, charting in Excel, advanced features, and the general use of Excel. This does not provide a general Excel tutorial nor the basics of using a spreadsheet. It provides specific answers to using Microsoft Excel only. If you do not see your Excel question answered in this area then please ask an Excel question here

Excel

Answers by Expert:

Selected as an Excel MVP by Microsoft since 1999. Answering Excel questions in Allexperts since its inception in 2001. Able to answer questions on almost all aspects of Excel's internal capabilities. If seeking a VBA solution, please specify that in your question itself so I give you the answer you want. [Excel has weak protection - if you are distributing an application, I don't answer questions on how to protect your project from your users.]

Extensive experience. **Education/Credentials**

Master of Science (MS) degree Operations Research (ORSA)**Awards and Honors**

Microsoft MVP in Excel.