join random numbers of the alphabet in one cell

jts2004

Board Regular
Joined
Apr 21, 2004
Messages
156
I need to join random numbers in the alphabet based on cell ref #.

EX: A1=1, A2=7, A3=9
ALPHABET IS IN CELL B1

ANSWER= AGI

This is a simplified version of what I need to do. My "alphabet" is a 1500 character text string and my cell ref are a in ranges of 5 rows X 13 colomns.
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
Well

=Mid(b1,A1,1) gives you the character from the alphabet in B1 in position A1

and =Mid(b1,A1,1)&Mid(b1,A2,1)

combines 2 together you just need to string this together another 63 times to get the whole string

or a user defined function to do the same might be

function cypher(mat as range, alph as string) as string
for each a in mat
cypher=cypher&mid(alph,a.value,1)
next
end function

then just call the function as =CYPHER(a2:M6,A1)

where A2:M6 has your matrix and A1 has the 1500 character alphabet string
 
Upvote 0
I thought of that but that would mean I would have to write a formula with 120 mid() strings together. Thanks anyway
 
Upvote 0
Try using cherria's UDF. It'll build your MID() functions for you in one simple formula.
 
Upvote 0
Yes, insert the code into a standard module, and when you use: "=CYPHER(range, alpha)", it will work just like a normal function.
 
Upvote 0
Works for me... make sure it's in a standard module, not a Sheet or ThisWorkbook module:
Book1
ABCD
120TEST
25TEST
319
420
5
6ABCDEFGHIJKLMNOPQRSTUVWXYZ
Sheet1


Code:
Function cypher(mat As Range, alph As String) As String
For Each a In mat
cypher = cypher & Mid(alph, a.Value, 1)
Next
End Function
 
Upvote 0

Forum statistics

Threads
1,214,601
Messages
6,120,465
Members
448,965
Latest member
grijken

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