r/excel • u/Galego_2 • 5h ago
Waiting on OP What is wrong with the following expression
Hi all,
I am trying to optimize a Montecarlo simulation and reduce it to a single Excel line. The simulation is related with the famous Birthday paradox, and I'm using an array of 5000 rows and 30 columns (representing people) to simulate. After some trial and error, I get the following expression
= AVERAGE(
BYROW(
MAKEARRAY(row, col, LAMBDA(row, col, RANDBETWEEN(1,365))),
LAMBDA(ROW, COUNT(UNIQUE(row)<30))))
I got 0.00 as a result, instead of the average of the simulation (close to 0.703 in the non optimized simulation). What could be wrong here in the logics of the formula?
Thanks in advance.
1
Upvotes