RAND Between

indygo

Board Regular
Joined
Dec 2, 2013
Messages
126
Office Version
  1. 365
Platform
  1. Windows
hi guys,

Two cells question with random numbers formula:

In A1 I have random number generator in a range from 1 to 99.
= RANDBETWEEN(1,99)

In B1 I want to add formula which would fluctuate values from A1 but within a certain range. So I have in B1 this formula:

=A1+RANDBETWEEN(-25,25)

That's the range I want B1 to move randomly. Now the problem is, I don't want B1 to go above or below the range of 1 to 99. If A1 generates random number let's say 5
and B1 generates -25 it will create -20. Now I want to avoid that.

Can we make b1 to be still random within that range but never exit range of 1-99?

I know I can make both cells random but they have to be related and move within a certain range.

thanks
 
Thanks.
Yes I'm aware of that. That's why I'm using full range in the main one 1-99. Second one is just simulating disagreement in values between first column and second. I'm checking various scenarios using different brackets in b1.

Thanks for pointing that out though.
 
Upvote 0

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).

Forum statistics

Threads
1,223,231
Messages
6,170,885
Members
452,364
Latest member
springate

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