Method 1 – Excel VBA to Select Only One Random Name from a List Steps: Press ALT + F11 to open the VBA window. Click on Insert and select Module. Insert the following code in the module: Sub Select1Random_Name() Dim xRow As Long xRow = [RandBetween(5,11)] Cells(14, 3) = Ce...
2。 继续输入以下公式:=INDEX($A$2:$A$15,RANK(B2,$B$2:$B$15))进入单元格C2,然后按输入键,从列A的数据列表中提取随机值,请参见屏幕截图: 备注:在上式中:A2:A15是您要从中选择随机单元格的数据列表,B2:B15是您插入的带有随机数的辅助列单元格。 3。 然后,选择单元格C2,将填充手柄向下拖动到要提...
Method 1 – Using the INDEX and RANDBETWEEN Functions to Select from a List Randomly Case 1.1 – Inserting the List Range Manually Steps: In Cell D5, insert the following formula: =INDEX(B5:B12,RANDBETWEEN(1,8)) Hit Enter, and you will get a random value like the image below. Formula...
With the above formula, you may find duplicates in the results. To make a random selection from a list with no repeats, the generic syntax is: =INDEX(SORTBY(data, RANDARRAY(ROWS(data))), SEQUENCE(n)) data: The list of values that you want to extract random items from; n: The numbe...
SubRandomSort()'Update by ExtendOfficeDimxRgAsRangeDimxNum,xF,xIAsIntegerDimxWSh,xAWShAsWorksheetOnErrorResumeNextApplication.ScreenUpdating=FalseApplication.DisplayAlerts=FalseSetxAWSh=Application.ActiveSheetSetxRg=ActiveWindow.RangeSelectionSetxWSh=Worksheets.Add xNum=xRg.CountForxF=xNumTo1Step-1xI=Worksh...
Either way, Excel automatically expands the selection and sorts the names in column A as well: Tips & notes: Excel RAND is avolatilefunction, meaning that new random numbers are generated every time the worksheet is recalculated. So, if you are not happy with how your list has been randomi...
要随机选择一位在纽约工作了3年的员工,请输入公式=INDIRECT("A"&LARGE(IF($B$2:$B$25=$F$1,IF($C$2:$C$25=$G$1,ROW($A$2:$A$25),0),0), RANDBETWEEN(1,COUNTIFS(B2:B25,F1,C2:C25,G1)))进入单元格,您将返回随机员工的姓名,然后按按Ctrl+转移+输入键同时。 请...
Unlike RAND() or RANDBETWEEN() functions, there is no default function dedicated to selecting random values. However, we will nest these functions with others and create a simple formula to do so. So, if you wish to extract random values from your data, keep reading!
Excel “expand the selection Step 8: Now that the list has been successfully sorted, you can go ahead and delete the column containing the random values in Excel. Excel deleting method That's how simple it is to randomize any list in Excel using a helper column with the RAND() function....
Excel.Worksheet ws = (Excel.Worksheet)this.Application.ActiveSheet; Excel.Range rng = ws.get_Range("RandomNumbers", Type.Missing); System.Random rnd = new System.Random(); for (int i = 1; i <= 20; i++) ws.Cells[i, 2] = rnd.Next(100); rng.Sort(rng, Excel.XlSortOrder.xlAscend...