VBA - Help with Random Number Generator

cosbys

New Member
Joined
Jun 26, 2012
Messages
1
I have a set of data I am interested in doing calculations with depending on scenarios. One particular scenario I want to do is randomly generated numbers down the 'S' range/column that sum to 0.

I have accomplished summing the column to 0 via the last row being the difference to 0; however, I also want the last number to be within my range of random numbers (which is 0 to 300).

Also, this is a part I have yet to tackle, but how would you make it so these randomly generated numbers averaged to a certain number (7 in this case)?

Thanks for the help.
 
Last edited:

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
I realize this is not VBA, but have you looked at the randombetween() function? You can probably call it in VBA But I've never done that.

The average will should, on average, be the mid point of your min/max.
 
Upvote 0

Forum statistics

Threads
1,223,910
Messages
6,175,320
Members
452,635
Latest member
laura12345

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