Assigning specific "letter" to a num.

rapitorres

New Member
Joined
Oct 5, 2017
Messages
26
Office Version
  1. 2010
Platform
  1. Windows
Hi
I need some help with converting a number to a specific letter. like a secret code

T A K E F L U S H X
1 2 3 4 5 6 7 8 9 0

1 = T
2 = A
3 = K
4 = E
5 = F
6 = L
7 = U
8 = S
9 = H
0 = X

all result must be in one cell

I tried the case function. i went like this

' Converts a number from 1 to 9 into text.
Function GetDigit(Digit)
Select Case Val(Digit)
Case 1: GetDigit = "T"
Case 2: GetDigit = "A"
Case 3: GetDigit = "K"
Case 4: GetDigit = "E"
Case 5: GetDigit = "F"
Case 6: GetDigit = "L"
Case 7: GetDigit = "U"
Case 8: GetDigit = "S"
Case 9: GetDigit = "H"
Case 0: GetDigit = "X"
Case Else: GetDigit = ""
End Select
 

Some videos you may like

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.

maabadi

Well-known Member
Joined
Oct 22, 2012
Messages
1,344
Office Version
  1. 2019
  2. 2016
Platform
  1. Windows
Please test this:
VBA Code:
Function GetDigit(InputData As Range) As String
 Dim cell As Range
 Dim x As String

    For Each cell In InputData
        
            x = Replace(cell.Value, "1", "T")
            x = Replace(x, "2", "A")
            x = Replace(x, "3", "K")
            x = Replace(x, "4", "E")
            x = Replace(x, "5", "F")
            x = Replace(x, "6", "L")
            x = Replace(x, "7", "U")
            x = Replace(x, "8", "S")
            x = Replace(x, "9", "H")
            x = Replace(x, "0", "X")
       
        GetDigit = x
    Next cell
End Function
 

Watch MrExcel Video

Forum statistics

Threads
1,122,756
Messages
5,597,933
Members
414,193
Latest member
bb60

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
Top