Quickly generate random groups for list of data in Excel
Sometimes, you may want to randomly assign data to groups as screenshot 1 shown, or generate groups for a list of names as below screenshot 2 shown, but how can handle these jobs quickly? Actually, in Excel, you can use formulas to solve them easily.
Screenshot1 | Screenshot2 |
![]() | ![]() |
Randomly assign data to groups
Generate random groups in a specified data size
If you want to randomly assign data to a specified number of groups, each group is allowed with different numbers of data, you can use the CHOOSE and RANDBETWEEN functions.
Select a blank cell next to the list you want to assign to random groups, copy or type this formula
=CHOOSE(RANDBETWEEN(1,3),"Group A","Group B","Group C ")
In the formula, (1, 3) indicates to group data into 3 groups, Group A, Group B and Group C are the texts will be displayed in formula cells which used to distinguish different groups.
Then drag fill handle down to randomly assign data into groups.
Then the list of data has been randomly assigned to groups, and each group may have different numbers of data.
The calculated results will not be fixed, they will be recalculated if there is any change to the workbook.

Unlock Excel Magic with Kutools AI
- Smart Execution: Perform cell operations, analyze data, and create charts—all driven by simple commands.
- Custom Formulas: Generate tailored formulas to streamline your workflows.
- VBA Coding: Write and implement VBA code effortlessly.
- Formula Interpretation: Understand complex formulas with ease.
- Text Translation: Break language barriers within your spreadsheets.
If you want to generate random groups for a list of data, and each group has a specified data size, you can use the ROUNDUP and RANK functions.
1. Firstly, you need a helper column to list some random data next to your data. Supposing in cell E2, type this formula
=RAND()
Then drag fill handle down to fill this formula to cells you use.
2. In the next column, supposing in cell F2, copy or type this formula
=ROUNDUP(RANK(E2,$E$2:$E$13)/4,0)
E2:E13 is the range that contains formula =RAND(), 4 is the number of data that you want each group contains.
The drag fill handle down to generate random groups for the list of data.
Best Office Productivity Tools
Supercharge Your Excel Skills with Kutools for Excel, and Experience Efficiency Like Never Before. Kutools for Excel Offers Over 300 Advanced Features to Boost Productivity and Save Time. Click Here to Get The Feature You Need The Most...
Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier
- Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
- Open and create multiple documents in new tabs of the same window, rather than in new windows.
- Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!