How can I use Excel to randomly select cells that meet a specific criteria? 2

How can I use Excel to randomly select cells that meet a specific criteria?

Using Excel, you can easily and efficiently select cells at random that meet a specific criteria. This can be done by using the built-in ‘RAND’ and ‘IF’ functions in Excel. First, you would use the ‘IF’ function to create a logical test that checks if the cells meet the desired criteria. Then, use the ‘RAND’ function to generate a random number for each cell. By sorting the cells based on the random numbers, you can select a group of cells that meet the criteria at random. This method allows for a quick and unbiased selection of cells, making it a useful tool for various data analysis and decision-making tasks.

Excel: Randomly Select Cells Based on Criteria


Often you may want to randomly select a cell based on specific criteria in Excel.

This tutorial provides two examples of how to do so using the following dataset in Excel:

Example 1: Randomly Select Cell Based on One Criteria

We can use the following formula to randomly select one player who is on the Mavs team:

=INDEX(A2:A14,LARGE(IF(B2:B14=A17,ROW(B2:B14)-ROW(B2)+1),INT(RAND()*COUNTIF(B2:B14,A17)+1)))

This particular formula will randomly select one cell from the range A2:A14 where the corresponding cell in the range B2:B14 is equal to the value in cell A17.

We can type this formula into cell A20 and then press Ctrl + Shift + Enter:

Excel random selection with criteria

We can see that the formula randomly selected Luka, who is a player on the Mavs team.

Feel free to double click cell A20 and press Enter to run the formula again.

Each time we run the formula, it’s possible that we will get a different player on the Mavs team.

Example 2: Randomly Select Cell Based on Multiple Criteria

We can use the following formula to randomly select one player who is on the Mavs team and is a Guard:

=INDIRECT("A"&LARGE(IF($B$2:$B$14=$A$17,IF($C$2:$C$14=$B$17,ROW($A$2:$A$14),0),0), RANDBETWEEN(1,COUNTIFS(B2:B14,A17,C2:C14,B17))))

This particular formula will randomly select one cell from the range A2:A14 where the cell in range B2:B14 is equal to the value in cell A17 and the cell in range C2:C14 is equal to the value in cell B17.

We can type this formula into cell A20 and then press Ctrl + Shift + Enter:

We can see that the formula randomly selected Reggie, who is a guard on the Mavs team.

Feel free to double click cell A20 and press Enter to run the formula again.

Each time we run the formula, it’s possible that we will get a different guard on the Mavs team.

Additional Resources

The following tutorials explain how to perform other common tasks in Excel:

How to Select a Random Sample in Excel

Cite this article

stats writer (2024). How can I use Excel to randomly select cells that meet a specific criteria?. PSYCHOLOGICAL SCALES. Retrieved from https://scales.arabpsychology.com/stats/how-can-i-use-excel-to-randomly-select-cells-that-meet-a-specific-criteria/

stats writer. "How can I use Excel to randomly select cells that meet a specific criteria?." PSYCHOLOGICAL SCALES, 28 Jun. 2024, https://scales.arabpsychology.com/stats/how-can-i-use-excel-to-randomly-select-cells-that-meet-a-specific-criteria/.

stats writer. "How can I use Excel to randomly select cells that meet a specific criteria?." PSYCHOLOGICAL SCALES, 2024. https://scales.arabpsychology.com/stats/how-can-i-use-excel-to-randomly-select-cells-that-meet-a-specific-criteria/.

stats writer (2024) 'How can I use Excel to randomly select cells that meet a specific criteria?', PSYCHOLOGICAL SCALES. Available at: https://scales.arabpsychology.com/stats/how-can-i-use-excel-to-randomly-select-cells-that-meet-a-specific-criteria/.

[1] stats writer, "How can I use Excel to randomly select cells that meet a specific criteria?," PSYCHOLOGICAL SCALES, vol. X, no. Y, ص Z-Z, June, 2024.

stats writer. How can I use Excel to randomly select cells that meet a specific criteria?. PSYCHOLOGICAL SCALES. 2024;vol(issue):pages.

Download Post (.PDF)
Slide Up
x
PDF
Scroll to Top