Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 13
Default replace or substitute a letter for a specific number

Say A=65, B=66, C=76.. Z=90
I want to convert the alfanumeric value "AB25" into 656625...
Cant find the way to replace/substitute A for 65 and B for 66 followed by 25
to make a
single number...
Is this possible???
THANX


  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 694
Default replace or substitute a letter for a specific number

Try this macro you have to open the macro editor, insert a module and paste
it in and then must =convertnr(A1) in B1 if the number is in A1.

Function convertnr(r As Range) As String
' could change it to string and adjust the ucase line to r only.
Dim s_converted As String
Dim s_original As String
Dim s As String
Dim i As Long

s_original = UCase(r.Value)
For i = 1 To Len(s_original)
s = Mid(s_original, i, 1)
If IsNumeric(s) Then
s_converted = s_converted & s
Else
s_converted = s_converted & Asc(s)
End If
Next i
convertnr = s_converted
End Function

--
Hope this helps
Martin Fishlock
Please do not forget to rate this reply.


"El Criollo" wrote:

Say A=65, B=66, C=76.. Z=90
I want to convert the alfanumeric value "AB25" into 656625...
Cant find the way to replace/substitute A for 65 and B for 66 followed by 25
to make a
single number...
Is this possible???
THANX


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 13
Default replace or substitute a letter for a specific number

Works perfect! Great!
Im reading the code... barely understant what it is doing... but it works...
I just had to make a previous step on another cell to remove spaces and "-"
by substitution... (That's easy!)
But if I want that formula to work on another book or other computer... i
have to copy it again?? well, yes on another PC, but on a new file as well?
Or the formula will become part of the Excell formulas ?

"Martin Fishlock" wrote:

Try this macro you have to open the macro editor, insert a module and paste
it in and then must =convertnr(A1) in B1 if the number is in A1.

Function convertnr(r As Range) As String
' could change it to string and adjust the ucase line to r only.
Dim s_converted As String
Dim s_original As String
Dim s As String
Dim i As Long

s_original = UCase(r.Value)
For i = 1 To Len(s_original)
s = Mid(s_original, i, 1)
If IsNumeric(s) Then
s_converted = s_converted & s
Else
s_converted = s_converted & Asc(s)
End If
Next i
convertnr = s_converted
End Function

--
Hope this helps
Martin Fishlock
Please do not forget to rate this reply.


"El Criollo" wrote:

Say A=65, B=66, C=76.. Z=90
I want to convert the alfanumeric value "AB25" into 656625...
Cant find the way to replace/substitute A for 65 and B for 66 followed by 25
to make a
single number...
Is this possible???
THANX


  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 620
Default replace or substitute a letter for a specific number

=CODE(LEFT(A6,1))&CODE(MID(A6,2,1))&MID(A6,3,999)
--
David Biddulph

"El Criollo" wrote in message
...
Say A=65, B=66, C=76.. Z=90
I want to convert the alfanumeric value "AB25" into 656625...
Cant find the way to replace/substitute A for 65 and B for 66 followed by
25
to make a
single number...
Is this possible???
THANX




  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 13
Default replace or substitute a letter for a specific number

Hey david...
That doesnt work... it has to change only the letters... if i enter no
letter it is changing the numbers also... And, in case there is another
letter say in position6 of the number, it doent change it either...
but the macro is doing allright...
TNX

"David Biddulph" wrote:

=CODE(LEFT(A6,1))&CODE(MID(A6,2,1))&MID(A6,3,999)
--
David Biddulph

"El Criollo" wrote in message
...
Say A=65, B=66, C=76.. Z=90
I want to convert the alfanumeric value "AB25" into 656625...
Cant find the way to replace/substitute A for 65 and B for 66 followed by
25
to make a
single number...
Is this possible???
THANX





Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Count number of uniques starting with a given letter? MeatLightning Excel Discussion (Misc queries) 1 April 26th 06 10:32 PM
Formula for cells that contain a specific letter carrielu Excel Worksheet Functions 5 April 14th 06 02:42 PM
linking a cell with a specific letter value to a cell with a formu tommo64 Excel Worksheet Functions 4 April 3rd 06 10:44 AM
Assigning a number value to a letter? Orphan86 Excel Discussion (Misc queries) 3 August 30th 05 11:45 PM
how do I find an average number of specific words in a column cashgrfx New Users to Excel 7 January 6th 05 04:44 PM


All times are GMT +1. The time now is 07:05 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"