RANDDATA Creates a 2D array (of n rows) of random data from a 2D array of fields/dimension data.
SORTROWS Lambda Function is used in this function.
SORTROWS Lambda Function is used in this function.
Excel Formula:
=LAMBDA(data,noOfRows,incValueColumn,minValue,maxValue,noOfDecimals,
LET(d,data,nOR,noOfRows,
c,COLUMNS(d),r,ROWS(d),
sC,SEQUENCE(,c+incValueColumn),sR,SEQUENCE(r),
mxRows,INDEX(SORTROWS(TRANSPOSE(ISBLANK(d)*(sR-1)),1),,1),
lastRow,TRANSPOSE(IF(mxRows=0,r,mxRows)),
sNR,SEQUENCE(nOR+1,c),rw,INT(sNR/(c+1)),sNR_1,SEQUENCE(nOR+1),
firstRows,2-(rw=0),
lastRows,IF(rw=0,1,(rw*0)+lastRow),
randArr,IF(incValueColumn,ROUND(RANDARRAY(nOR,1,minValue,maxValue,FALSE),noOfDecimals)),
amountColumn,IF(incValueColumn,IF(sNR_1=1,"Amount",INDEX(randArr,sNR_1-1))),
dataRow,IF(sC=c+1,amountColumn,INDEX(d,RANDBETWEEN(firstRows,lastRows),sC)),
dataRow)
)
Book1 | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
A | B | C | D | E | F | G | H | I | J | K | L | |||
1 | Country | Area | Month | Person | Currency | Country | Area | Month | Person | Currency | Amounts | |||
2 | Scotland | North | Jan | Andy | GBP | Italy | South | Dec | Barry | USD | 1495 | |||
3 | England | East | Feb | Dave | USD | Wales | West | Mar | Karen | GBP | 1139 | |||
4 | Wales | South | Mar | Michelle | Wales | East | Sep | Andy | GBP | 654 | ||||
5 | Ireland | West | Apr | Esme | Wales | West | May | Esme | USD | 1203 | ||||
6 | France | May | Barry | Italy | South | Aug | Esme | USD | 914 | |||||
7 | Italy | Jun | Karen | Scotland | East | Jun | Barry | USD | 1192 | |||||
8 | Jul | Wales | South | Sep | Karen | USD | 842 | |||||||
9 | Aug | Scotland | West | Jul | Michelle | GBP | 811 | |||||||
10 | Sep | France | South | Apr | Andy | USD | 457 | |||||||
11 | Oct | England | West | Aug | Barry | USD | 1495 | |||||||
12 | Nov | Ireland | West | Aug | Dave | USD | 278 | |||||||
13 | Dec | Ireland | North | Apr | Andy | USD | 625 | |||||||
14 | England | North | May | Karen | GBP | 1030 | ||||||||
15 | Italy | West | Sep | Karen | USD | 458 | ||||||||
16 | Scotland | West | Apr | Barry | GBP | 715 | ||||||||
17 | England | South | Feb | Michelle | GBP | 945 | ||||||||
18 | Ireland | West | Jun | Andy | GBP | 1216 | ||||||||
19 | England | North | Jul | Andy | GBP | 446 | ||||||||
20 | England | North | Oct | Andy | GBP | 443 | ||||||||
21 | France | South | Feb | Michelle | GBP | 1339 | ||||||||
Data |
Cell Formulas | ||
---|---|---|
Range | Formula | |
G1:L21 | G1 | =RANDDATA(A1:E13,20,1,200,1500,0) |
Dynamic array formulas. |
Last edited by a moderator:
Upvote
0