Generating Random data in Excel



Sometimes we are required to use a list of names constructed from some chars followed by random numbers

In order to use the parameter type FILE in LR parameter list with names constructed from chars followed by random numbers you might be require to develop a function to create names dynamically.

Use the excel functions below to generate a random chars strings followed by random number generated between a given range, one for uppercase chars and the other for lowercase chars, as shown below.
The prefix can be changed according to your needs, with simple adjustments.

It’s a simple but effective way to create a list of names to suite our needs.

Functions :

Starting Letter Capital F followed by 6 small Letters

=TEXT(RANDBETWEEN(97,122),)&CHAR(RANDBETWEEN(70,70))&CHAR(RANDBETWEEN(97,122))&CHAR(RANDBETWEEN(97,122))&CHAR(RANDBETWEEN(97,122))&CHAR(RANDBETWEEN(97,122))&CHAR(RANDBETWEEN(97,122))&CHAR(RANDBETWEEN(97,122))

Output:- E.g. Fteqebz
               Starting Letter F followed by random 6 a-z characters.

All Capital letters starting with letter A

=TEXT(RANDBETWEEN(65,90),)&CHAR(RANDBETWEEN(65,65))&CHAR(RANDBETWEEN(65,90))&CHAR(RANDBETWEEN(65,90))&CHAR(RANDBETWEEN(65,90))&CHAR(RANDBETWEEN(65,90))&CHAR(RANDBETWEEN(65,90))&CHAR(RANDBETWEEN(65,90))

Output:- E.g. AUTXCHD
                 Starting Letter A followed by random 6 A-Z characters.

Starting Letter Capital F followed by 8 small Letters and some digits within range 1000-99999

=TEXT(RANDBETWEEN(97,122),)&CHAR(RANDBETWEEN(70,70))&CHAR(RANDBETWEEN(97,122))&CHAR(RANDBETWEEN(97,122))&CHAR(RANDBETWEEN(97,122))&CHAR(RANDBETWEEN(97,122))&CHAR(RANDBETWEEN(97,122))&CHAR(RANDBETWEEN(97,122))&CHAR(RANDBETWEEN(97,122))&CHAR(RANDBETWEEN(97,122))&RANDBETWEEN(1000,99999)

Output:- E.g Fnejrhidw75028
Starting Letter Capital F followed by 8 small Letters and some  digits within range 1000-99999


What is an ASCII chart?
An ASCII Chart is a simple way to keep a list of what all the printable, or displayable characters are.

Ascii representation is as below:

32 is a space
48 to 57 are our numbers 0-9
65 to 90 are the capital letters A-Z
97 to 122 are the lowercase letters a-z

Important Tip:

In Excel, every time the worksheet calculates, these codes will change,
so if you want them to remain same you will have to copy them and use PasteSpecial -> Values to convert the formulas to static values.

Comments

Popular posts from this blog

Steps to Analyze AWR Report in Oracle

Vmstat Output explained

Verifications and Error Handling in LoadRunner *Web_reg_find and Web_reg_save_param*