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.
 

Some videos you may like

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.

yee388

Well-known Member
Joined
Mar 7, 2004
Messages
1,374
Something like this?
Book1
ABCD
120
25TEST
319
420
5
6ABCDEFGHIJKLMNOPQRSTUVWXYZ
Sheet1
 

cherria

Well-known Member
Joined
Nov 17, 2004
Messages
708
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
 

jts2004

Board Regular
Joined
Apr 21, 2004
Messages
156
I thought of that but that would mean I would have to write a formula with 120 mid() strings together. Thanks anyway
 

yee388

Well-known Member
Joined
Mar 7, 2004
Messages
1,374

ADVERTISEMENT

Try using cherria's UDF. It'll build your MID() functions for you in one simple formula.
 

jts2004

Board Regular
Joined
Apr 21, 2004
Messages
156
do I just copy that code into a module? I have never created a function before
 

yee388

Well-known Member
Joined
Mar 7, 2004
Messages
1,374

ADVERTISEMENT

Yes, insert the code into a standard module, and when you use: "=CYPHER(range, alpha)", it will work just like a normal function.
 

yee388

Well-known Member
Joined
Mar 7, 2004
Messages
1,374
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
 

yee388

Well-known Member
Joined
Mar 7, 2004
Messages
1,374
Though it could be that your alpha string is too long...
 

Watch MrExcel Video

Forum statistics

Threads
1,122,498
Messages
5,596,509
Members
414,073
Latest member
Contilly

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