Please help

Josh324

New Member
Joined
Nov 29, 2020
Messages
6
Office Version
  1. 365
Platform
  1. Windows
Is there a way I can convert the letter A to 13 and B to 15 number won’t be in order with the letter. need to be able to type a word and for it to spit out a very long number.
For example if I was to type hello need a number 22 23 26 26 35.
its for an old alarm panel I need to program and it only allows number input so wanted to know if there was a way I could decode instead of pen and paper. Any help would be much appreciated.
 
Brilliant! Thank you so much for your brilliant formula.
You're welcome - but we better give Rick credit for manufacturing the string. :)

If you did want an alternative that is a bit easier to follow (but somewhat longer) you could consider the version below. In this formula, each pair of digits in the number string correspond in order to the characters in the text string. I have matched a few with colours to illustrate (hard to colour the space though ;))

=CONCAT(MID("2113151617181920222324252627283133343536373840414244454647484950515253",SEARCH(MID(A1,SEQUENCE(LEN(A1)),1)," ABCDEFGHIJKLMNOPQRSTUVWXYZ.'/-+&()")*2-1,2))

Josh324.xlsm
AB
1hello2218262631
2goodbye20313117154418
3John & Mary-Jo O'Connor/(Hill)243122282151212713354449243121314716312828313548522223262653
Sheet3
Cell Formulas
RangeFormula
B1:B3B1=CONCAT(MID("2113151617181920222324252627283133343536373840414244454647484950515253",SEARCH(MID(A1,SEQUENCE(LEN(A1)),1)," ABCDEFGHIJKLMNOPQRSTUVWXYZ.'/-+&()")*2-1,2))
 
Upvote 0

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
If it is no problem for you to use a worksheet for this, you could set up this worksheet as below.

Book1
ABCDEFGHIJKLMNOPQRSTUVWXYZAAABACADAEAFAGAHAI
1ABCDEFGHIJKLMNOPQRSTUVWXYZ.'/-+&()
21315161718192022232425262728313334353637384041424445214647484950515253
3(hello)52221826263153
4o /'+&-31214847505149
Sheet1
Cell Formulas
RangeFormula
B3:B4B3=DoCode(A3)


A custom function is used (DoCode). To make this work copy the code and open the VBA editor by pressing ALT F11. Within VBE press ALT i followed by ALT m to insert a standard module. Paste the code of the custom function in the just opened pane.

VBA Code:
Public Function DoCode(ByRef argString As String) As String

    Dim i As Long, s As String, r As Range, c As Range

    Application.Volatile
    With ThisWorkbook.Sheets("Sheet1")
        Set r = .Range(.Cells(1, 1), .Cells(1, .Columns.Count).End(xlToLeft))
    End With
    For i = 1 To Len(argString)
        Set c = r.Find(Mid(argString, i, 1), , xlValues, xlWhole)
        s = s & c.Offset(1).Value
    Next i
    DoCode = s
End Function
Thank you for your rapid response will try this one tonight
 
Upvote 0
Hi,
Another way using Vlookup
You will need to type '/ to get / and '' to get '

Book2
ABCDEFGHIJKLMNOPQRST
121actual space in the cell A1
2A13
3B15my/passy&).'
4C1627444833133636445121534647--
5D17
6E18
7F19
8G20
9H22
10I23
11J24
12K25
13L26
14M27
15N28
16O31
17P33
18Q34
19R35
20S36
21T37
22U38
23V40
24W41
25X42
26Y44
27Z45
28.46
29'47need to type as two ''
30/48need to type as '/
31-49
32+50
33&51
34(52
35)53
Sheet1
Cell Formulas
RangeFormula
F4:T4F4=IFERROR(VLOOKUP(F$3,$A$1:$B$35,2,FALSE),"-")
Thanks for your help will try this tonight on my laptop.
 
Upvote 0

Forum statistics

Threads
1,214,967
Messages
6,122,503
Members
449,090
Latest member
RandomExceller01

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top