WouterS
WouterS

Reputation: 131

RANDBETWEEN in excel

This is driving me nuts. I want to generate a random number in excel but in the following format

+++522/7226/61416+++

So I need 3 blocks of numbers randomly generated 1ste block = RANDBETWEEN(0;999) 2nd block = RANDBETWEEN(0;9999) 3rd block = RANDBETWEEN(0;99999)

I know how RANDBETWEEN works but I can't to get it working with the +++ and the /

Upvotes: 1

Views: 417

Answers (1)

VBA Pete
VBA Pete

Reputation: 2666

How using & and " " to include strings:

="+++"& TEXT(RANDBETWEEN(0;999);"000")&"/"&TEXT(RANDBETWEEN(0;9999);"0000")&"/"&TEXT(RANDBETWEEN(0;99999);"00000")&"+++"

Even more efficient is Ron's suggestion below:

=TEXT(RANDBETWEEN(1;999999999999);"+++000\/0000\/00000+++")

Upvotes: 4

Related Questions