![]() Now follow the fifth step from the first example to open the Macros dialog box.Also used another For Loop to place those extracted random selections in the selected cell.Then, I used a For Loop to extract the values from the list where I used an IF statement to check if the cells contain values or not.Next, I used a Do While loop to go through the name_list until I get 4 values, these 4 values are selected by using the VBA RandBetween function.Then used CountA(Range(“A:A”)) – 3 to determine names in the list.ReDim Array_for_Names(1 To xNumber) will resize the array for the selected names.CellsOut_Number = 7 is the first-row number to place the output.Next, used Range(“E4”).Value to pick the selection number from Cell E4.Then declared some variables- xNumber As Integer, xNames As Long, xRandom As Integer, Array_for_Names() As String, i As Byte, CellsOut_Number As Long, Ar_I As Byte.Here, I created a Sub procedure Select_Any_NumberOf_Names.If Array_for_Names(Ar_I) = Cells(xRandom, 1).Value ThenĪrray_for_Names(j) = Cells(xRandom, 1).ValueĬells(CellsOut_Number, 5) = Array_for_Names(Ar_I) XRandom = Application.RandBetween(4, xNames + 1)įor Ar_I = LBound(Array_for_Names) To UBound(Array_for_Names) XNames = Application.CountA(Range("A:A")) - 3 Follow the first two-step from the first example to open the VBA window and insert module.I specified 4 in Cell E4 to select 4 names at a time and will show the output in cells E7:E10. For this example, I have modified the dataset. Here, We’ll select a set of random names at a time according to our specified number. Embed VBA to Select Any Number of Random Names from a List Read More: How to Make a Random Selection from List Without Repetition in ExcelĢ. Soon after, you will see that a random name is picked up from the selection.īy running the Macro again and again you will get new random names. Next, select the macro name as mentioned in the Codes.Then click as follows: Developer ➤ Macros to open the Macros dialog box.Finally, Cells(14, 3) = Cells(xRow, 2) will show the output in Cell C14.Next, used the function RandBetween to select a random item from the row range 5 to 11.First, I created a Sub procedure Select1Random_Name. ![]() □ User-Friendly: A breeze for beginners and a powerful tool for experts. □ Seven Types of Drop-down Lists: Make data entry a breeze with seven dynamic drop-down lists. □️ Robust Navigation Pane: Get an edge with the powerful Column Manager, Worksheet Manager, and Custom Favorites. □ Custom Charts and Reports: Get access to a wide variety of additional charts and produce insightful reports that speak volumes. ⏱️ Batch Operations: Why work harder when you can work smarter? Import, export, combine, and manipulate data in bulk effortlessly. □ Robust Data Processing: From merging cells, removing duplicates to advanced data conversion – all without the hassle! □️ Over 300 Powerful Functions: Kutools comes jam-packed with more than 300 functions, streamlining your work for over 1500 scenarios. Streamline complex tasks and breeze through your data like a pro. Looking to turbocharge your Excel tasks? Unleash the power of Kutools for Excel - the ultimate time-saving tool for your spreadsheets. Turn Hours into Minutes with Kutools for Excel! With the Sort Range Randomly utility of Kutools for Excel, you can quickly select random names from list in Excel. Select random name from a list with Kutools for Excel ![]() Then you will get random names from a specified list without duplicates as the above screenshot shown. Select the result cell and then drag its Auto Fill Handle over the cells to display the random names. Select a blank cell to ouput the random name (here I select C2), enter the below formula into it and press the Enter key. Then select the result cell and drag its Auto Fill Handle over the helper column cells to get the other results.Ģ. Select a blank cell next to the first name of the list (here I select B2), enter the below formula into it and press the Enter key. ![]() Select random names from a list without duplicatesĪs the above formula may cause duplicate random names in the result, in this section, we will show you two formulas to help selecting random names from a list without duplicates in Excel.ġ. The random name will be changed automatically every time you refresh the worksheet. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |