Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Excel RANDBETWEEN as a string

How does one use a string value as a random value, I have 3 values namely SMS, Datasynergy and Other, i want to simulate live data by using the random function to assign one of the aforementioned value to my field at random?

The way i thought of it is to make a random value between 1-3 and and then go on to say if 1 = SMS else if 2 = Datasynergy else Other

But im pretty sure there must be other ways of doing this?

Thanks in advance.

like image 663
Silentdarkness Avatar asked Oct 31 '25 12:10

Silentdarkness


2 Answers

try this

=CHOOSE(RANDBETWEEN(1,3),"SMS","Datasynergy","Other")
like image 67
chris neilsen Avatar answered Nov 03 '25 09:11

chris neilsen


Another way is to use INDEX, e.g.

=INDEX({"SMS","Datasynergy","Other"},RANDBETWEEN(1,3))

which you can easily adapt for a longer list like this

=INDEX(List,RANDBETWEEN(1,COUNTA(List)))

like image 30
barry houdini Avatar answered Nov 03 '25 10:11

barry houdini