Public Schedule Face-to-Face & Online Instructor-Led Training - View dates & book

randomising

ResolvedVersion 365

Kat has attended:
Excel Intermediate course

Randomising

For a while now I have been looking for a way to assign randomly text cells to other text cells with a limit of spaces on the latter. As an example, if I had a list of people's names in excel and list of office locations with different number of available desks in each office. I would like to randomly assign people to locations in a separate column but in a way that only the number of people is assigned to a location that matches the number of available desks in this location.

RE: Randomising

Thanks for putting this as a question. I have had a little time to play around with this, and I have come up with a solution. I will upload a test file here that might make it easier for you to copy it as well.

Turns out the complicated part is not the randomising, but the getting a list of desks.

In my data, I put a list of the locations in column E, and the list of how many desks in that location in column F.

The formula in column B then checks that list and repeats the location for the correct number of times for how many desks there are. That function is: =XLOOKUP(TRUE, COUNTIF($B$1:B1, $E$2:$E$4) < $F$2:$F$4, $E$2:$E$4, "No Available Desk")

You can adjust the E4 and F4 values in that function to account for how many different locations you have. Drag down that function in column B and it will give you a list of all the desk locations.

If that is too complicated, you can also just manually type how many desks for each location into column B.

To get the random order, we can use the RAND function. I have the list of all the names in column A, and in column C I have written '=RAND()'. I then autofilled that function down to the rest of the column. This now assigns a random number to each person.

To randomise the names, you can click on any number in column C, go to the home tab in your ribbon > Sort and Filter > Sort Smallest to Largest.

It won't change the order of the data in column B, but the names in Column A will rearrange themselves to fit this new order.

Because column C will randomise itself each time you do this, you can repeat the sort in order to generate a new randomised list.

Hopefully that makes sense. Please do let me know if you need any further advise with it.

Attached files...

Random List.xlsx

Fri 14 Mar 2025: Automatically marked as resolved.

Excel tip:

Moving or Copying Sheets Between Workbooks in Excel 2010

Here's how to move or copy sheets between workbooks in Excel 2010:

Open the sheet you want to move or copy then on the Ribbon click the Home tab. Click Format. Under Organize Sheets, select the option Move or Copy Sheet and then choose where you want the sheet to be moved/copied to.

View all Excel hints and tips

Connect with us:

0207 987 3777

Call for assistance

Request Callback

We will call you back

Server loaded in 0.09 secs.