specify gap size using Randbetween function

White Top

New Member
Joined
May 1, 2019
Messages
2
How can RANDBETWEEN(1,850) be modified to select numbers <+8 or >-8 of the previous selection?
Thanks, White Top
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
a​
b​
2​
254​
a2: =randbetween(1, 850)
3​
249​
a3: =randbetween(max(1, a2 - 8), min(a2 + 8, 850))
4​
249​
5​
253​
6​
252​
7​
252​
8​
260​
9​
266​
10​
266​
11​
271​
12​
272​
13​
268​
14​
273​
15​
271​
16​
267​
17​
268​
 
Upvote 0
a​
b​
2​
254​
a2: =randbetween(1, 850)
3​
249​
a3: =randbetween(max(1, a2 - 8), min(a2 + 8, 850))
4​
249​
5​
253​
6​
252​
7​
252​
8​
260​
9​
266​
10​
266​
11​
271​
12​
272​
13​
268​
14​
273​
15​
271​
16​
267​
17​
268​

<tbody>
</tbody>
Excellent! Thank you, works like a charm! One more very useful bit for my toolkit. Many thanks.
 
Upvote 0

Forum statistics

Threads
1,215,772
Messages
6,126,806
Members
449,337
Latest member
BBV123

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