formula for pyramid distribution? For Google Sheets

smking204

New Member
Joined
Jan 28, 2021
Messages
29
Office Version
  1. 365
Platform
  1. Windows
I've got a doozy for y'all. I want to create a formula that will return a random integer according to a pyramid distribution.

For example, A1 might serve as my input, which is itself a randomized integer, let's call it 24 for now. In B1, then, I want my pyramid formula, which will return a new integer that is + or - 50% of the input, but weighted toward the middle (12 and 36 would each have one chance of appearing, 13 and 35 would each have two chances, 14 and 34 would each have 3, and so on).

The formula needs to be 1) dependent on the variable input, and 2) able to be retooled for a different percentage

WAY too much math for me, but I hope to get some responses to dissect and get a little better at this sort of thing. Thanks a ton!
 
I tweaked the normal distribution formula so that it limits the results to +/- 50%. It works, but the endpoints will be a bit higher than expected (see the graph below). I experimented with changing the size of the standard deviation. I originally used a divisor of 2 which made the endpoints significantly higher. I used a divisor of 3, which made the endpoints about what you'd want, but it made the rest of the values drop off much quicker too. I think a divisor of 2.5 is about the best compromise.

Book1 (version 1).xlsb
ABCDE
10MidpointRangeRandom #
202450%25
30
40
50
60
70
80
90
100
110
1225.........................
1311...........
1429.............................
1539.......................................
1650..................................................
1756........................................................
1889.........................................................................................
19111...............................................................................................................
20115...................................................................................................................
21140............................................................................................................................................
22154..........................................................................................................................................................
23200........................................................................................................................................................................................................
24168........................................................................................................................................................................
25153.........................................................................................................................................................
26132....................................................................................................................................
27116....................................................................................................................
28109.............................................................................................................
2978..............................................................................
3073.........................................................................
3139.......................................
3240........................................
3325.........................
3424........................
359.........
3615...............
370 
End
Cell Formulas
RangeFormula
E2E2=MEDIAN(INT(NORM.INV(RAND(),B2,B2*C2/2.5)),INT(B2-B2*C2),ROUNDUP(B2+B2*C2,0))
B12:B37B12=REPT(".",A12)




As far as I know, all these functions exist in Google Sheets, although with slightly different names (NORM.INV --> NORMINV). I hope it works for you, but if not, you'll have to find someone else to step in. Good luck!
You're a good man, Eric! Thanks so much, I'll be parsing through this and your earlier responses, they've been super helpful.
 
Upvote 0

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.

Forum statistics

Threads
1,214,651
Messages
6,120,738
Members
448,988
Latest member
BB_Unlv

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top