79569408

Date: 2025-04-11 17:21:57
Score: 0.5
Natty:
Report link

If your original data was made with the following formula, this will give you a value between 1 and 7 and stored in cell A1:

=rand()*6+1

You could then do the following:

=MIN(MAX(A1+RAND()*4-2,1),7)

I like the more granular approach of rand()*6+1 vs randbetween - it gives you the same answer, but is more easily generalized with basically the same number of characters being typed.

edit: randbetween gives you integer values only, so in truth you'd need =round(rand()*6+1,0) to get the EXACT same values. That being said, when I'm trying to get random numbers I usually want artificial extra precision.

If you don't, the second formula can also be modified to be:

=round(MIN(MAX(A1+RAND()*4-2,1),7),0)

Reasons:
  • Long answer (-0.5):
  • No code block (0.5):
  • Low reputation (0.5):
Posted by: Jim