Random String Generator

M

Michael Noblet

I am working on creating data in a spread sheet to ne
used for a mail merge in word. I have 1000 rows and
would like to have excel radomoanly generate 3 defined
text strings in one collumn. Foe example I am talking
about plane, train, and Car. I would like to be able to
have excel fill in 1000 rows randomly with the
text "plane" "train" or "car"

I can do this with VB script bt is there an easier way?
 
N

Nicky

Hi
The easiest way would be to use a function, eg

Function trans_mode()
Dim modez
modez = Array("car", "train", "plane")
num = Int((UBound(modez) - LBound(modez) + 1) * Rnd + LBound(modez))
trans_mode = modez(num)
End Function

alternatively, you could generate a random number 1 and 3 in each cel

=randbetween(1,3)

and then format the number to return different values

eg format! cells! number! custom!
and use format:
[<2]"plane";[<3]"car";"train"

technically, this creates numbers not strongs, but it will achieve th
appearance you wan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top