Nota
L'accesso a questa pagina richiede l'autorizzazione. È possibile provare ad accedere o modificare le directory.
L'accesso a questa pagina richiede l'autorizzazione. È possibile provare a modificare le directory.
A volatile function recalculates whenever Excel recalculates, even if none of the function arguments changed. Use a volatile custom function for values that can change independently of their inputs, such as dates, times, random numbers, and simulation results.
Note
Several built-in Excel functions are volatile, such as RAND, TODAY, and NOW.
To mark a custom function as volatile, add the @volatile tag to its JSDoc comment. For more information about custom functions JSON metadata, see Autogenerate JSON metadata for custom functions.
Create a volatile custom function
The following example uses @volatile to create a custom function that simulates rolling a six-sided die.
/**
* Simulates rolling a six-sided die.
* @customfunction
* @volatile
*/
function roll6sided() {
return Math.floor(Math.random() * 6) + 1;
}