Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

rand randbetween

Is there a way in Numbers to use RAND or RANDBETWEEN to generate a random number but without it generating a new random number whenever any cell is changed? I want to generate a random number once and then again only if a particular cell is changed, not if just any cell is changed. Thanks for any ideas!

iMac 27″, macOS 12.0

Posted on Jan 24, 2022 11:55 AM

Reply
Question marked as Best reply

Posted on Jan 24, 2022 1:15 PM

Numbers Tables automatically recalculate every time there is a change to the table. Generating and retaining a random number requires making that number "NOT function dependent" when placed in the table.


Use three cells.

Put the RAND (or RANDBETWEEN) function in one of the cells.

Use the second cell as the 'source' cell for any further calculation.

Set the data format of the third cell to Checkbox.


Each time you need a random value, click the checkbox to change its contained value and trigger a recalculation of the table (including the RAND cell).

Select the RAND cell and copy.

Select the source cell and Paste Formula Results to paste the value copied from the RAND cell, but not the formula generating those values.


This process can likely be written into an Applescript script, placed in the Scripts menu, and assigned a keystroke combination, reducing the workstream process to:


select the 'source' cell

press the keystroke combination.

2 replies
Question marked as Best reply

Jan 24, 2022 1:15 PM in response to caf

Numbers Tables automatically recalculate every time there is a change to the table. Generating and retaining a random number requires making that number "NOT function dependent" when placed in the table.


Use three cells.

Put the RAND (or RANDBETWEEN) function in one of the cells.

Use the second cell as the 'source' cell for any further calculation.

Set the data format of the third cell to Checkbox.


Each time you need a random value, click the checkbox to change its contained value and trigger a recalculation of the table (including the RAND cell).

Select the RAND cell and copy.

Select the source cell and Paste Formula Results to paste the value copied from the RAND cell, but not the formula generating those values.


This process can likely be written into an Applescript script, placed in the Scripts menu, and assigned a keystroke combination, reducing the workstream process to:


select the 'source' cell

press the keystroke combination.

rand randbetween

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.