- Trending Categories
- Data Structure
- Operating System
- MS Excel
- C Programming
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to generate random value from a given list in Excel?
This article is designed to allow users to understand the process and can generate random data values, from the provided list of data that is based on some predefined or provided data set or collection. Here, data can be of any type, for example, string, int, and any other. For this article will assume that the available data is of string type. The article contains two examples, first example performs the provided task by using the predefined formula. While the second example will perform the same task by using the kutool.
Example 1 − To generate random value from a given list in Excel by using predefined formula.
Consider below given Excel sheet with sample data to understand the method to generate random values from a given list in Excel sheet:
Go to the B2 cell and type formula “=INDEX($A$2:$A$6, RANDBETWEEN(2, 6))”.
An explanation for the formula:
INDEX() is a predefined Excel method. This method returns a reference value from the specified range.
A2 to A6 cells are the range data cells.
RANDBETWEEN() method is used to generate random numbers between the provided cell references, that is between row 2 and row 6. This function will pass a random index value to the INDEX() method.
And, finally, INDEX() method, will read the index value and display the associated cell data on the worksheet.
Press the “Enter” key. This will display a color name randomly on the B2 cell. consider below depicted image for proper reference:
Note − The same procedure will work for all the other data types such as int, string, and others as well.
Example 2: To generate random value from a given list in Excel by using Kutool.
Consider the same Excel sheet again:
Go to the menu ribbon and click on the “Kutools” option. After that go to the “Editing” section. Choose the “Insert” option, and opt for the “Insert Random Data” option as shown in the below image.
This will open the “Insert Random Data” dialog box as shown below image:
Select the last option tab “Custom list”. As the provided data is of string data type and user needs to add the data set into the list value, to generate a common random value from them. After that clock on the first “plus sign” option shown below, to add the data range.
This will open the below given dialog box
To add range, click on the side button, and use the mouse to select available data from the sheet.
Use the mouse to select the data rows. The provided data range is A2 to A6. After that click on the “OK” button
This will display the previous dialog box, again. But, this time the dialog box contains all the data values of the specified range. Simply click on “Ok” button.
This will add the selected data to the custom list. Now, again click on “OK”.
Random data values will be displayed on the console.
This will display a random data value on the active cell. consider below given output to understand the results properly:
After the successful completion of the above article, the user can easily understand the process of generating random data from the provided data set. In Excel, the same task can be done in multiple ways. But, in this article, the main focus is to guide the user about the most basic ways, by using which generating random data from the data set to become too easy and effective.
Kickstart Your Career
Get certified by completing the courseGet Started