Random numbers
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hello All,
I need to generate random numbers up to the "Count of ID" that will equal the amount indicated in the 3rd column. I need help.
Month | Count of ID | Amount |
JAN | 30 | 525,050.01 |
FEB | 26 | 373,365.10 |
MAR | 26 | 454,834.22 |
APR | 26 | 372,316.54 |
MAY | 37 | 254,985.76 |
JUN | 33 | 191,889.21 |
JUL | 34 | 182,674.81 |
AUG | 31 | 157,652.11 |
SEP | 37 | 127,869.98 |
OCT | 47 | 112,130.36 |
NOV | 39 | 141,826.33 |
DEC | 41 | 148,695.32 |
Solved! Go to Solution.
- Labels:
- Workflow
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hi @Emma007 ,
Can you please give an example or illustration? you are saying that Count of ID with equal Amount?
Kamen
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hi @kamenrider,
So take January for eg. I want 30 generated rows with random numbers that add up to 525,050.01
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
so this is a batch macro -> iteratice macro process. Which is rare. because almost nothing is actually best done with an iterative macro. do you have any rules with the initial random amounts (ie they should be no more or not less than X % of the total) - asking because the way how randomness works, random number 1 could be 90% of the total- and you may want to some kind of mean/standard deviation limits on the random number.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Super Great!! Thanks so much. Super grateful
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Great to hear @Emma007 - can you mark my post as a solution?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Here is a macro-free solution. This is actually a complex issue because how to handle randomness is not straight-forward. Fundamentally, you can just generate random numbers for all [Count of ID] records, and then normalize the results to the target sum:
I rounded to 2 decimal places, so there is technically a slight bit of non-randomness involved, which is the allotment/removal of remaining/extra decimals to the first record of each group.
Hope this helps and Happy Solving!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
I am deeply grateful for your support. Thank you so much.
