Assigning specific "letter" to a num.

rapitorres

New Member
Joined
Oct 5, 2017
Messages
39
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
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
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
 
Upvote 0

Forum statistics

Threads
1,214,784
Messages
6,121,535
Members
449,037
Latest member
tmmotairi

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