RANDARRAY

    Math & Trig

    Returns an array of random numbers between specified bounds. You can choose the dimensions of the array, the min/max values, and whether to return integers or decimals.

    Translations
    EnglishRANDARRAY
    FrenchTABLEAU.ALEAT
    SpanishMATRIZALEAT
    GermanZUFALLSMATRIX
    ItalianMATR.CASUALE
    PortugueseMATRIZALEATÓRIA
    DutchASELECTMATRIX
    PolishLOSOWA.TABLICA
    RussianСЛУЧМАССИВ
    TurkishRASGELEDİZİ
    CzechNÁHČÍSLOMATICE
    HungarianVÉLETLEN.TÖMB
    SwedishSLUMPMATRIS
    DanishTILFARRAY
    FinnishSATUNNAISMATRIISI
    Syntax
    RANDARRAY([rows], [columns], [min], [max], [whole_number])

    Arguments

    • rowsOptional. Number of rows to return (default 1).(optional)
    • columnsOptional. Number of columns to return (default 1).(optional)
    • minOptional. Minimum value (default 0).(optional)
    • maxOptional. Maximum value (default 1).(optional)
    • whole_numberOptional. TRUE for integers, FALSE (default) for decimals.(optional)
    Examples
    =RANDARRAY(3,2)
    (3×2 array)

    3 rows × 2 columns of decimals 0-1

    =RANDARRAY(5,1,1,100,TRUE)
    (5 integers)

    5 random integers between 1 and 100

    Tips & Best Practices
    • Available in Microsoft 365 / Excel 2021 only
    • Recalculates every time the worksheet recalculates (volatile)
    • Returns #VALUE! if max < min or if whole_number is TRUE without integer min/max
    Common Mistakes
    • Forgetting that RANDARRAY is volatile and recalculates every time the worksheet recalculates, so a value used for something meant to stay fixed will keep changing unless converted to a static value
    • Setting whole_number to TRUE while min or max aren't whole numbers themselves, which can produce a #VALUE! error or unexpected rounding behavior
    • Not accounting for the fact that RANDARRAY is only available in Microsoft 365 / Excel 2021 and later, which will break the formula entirely in older Excel versions
    Related Functions
    RANDGenerates a single random decimal between 0 and 1, the simpler single-value building block that RANDARRAY extends into a full array with configurable bounds.
    RANDBETWEENGenerates a single random integer within a range, similar to what RANDARRAY does with whole_number set to TRUE, but for just one value instead of an array.
    SEQUENCEGenerates an array of sequential (non-random) numbers, useful for comparison when a predictable rather than random array is needed.
    Frequently Asked Questions

    Why does my RANDARRAY result keep changing?

    RANDARRAY is volatile by design and recalculates every time anything on the worksheet changes - copy the result and use Paste Special > Values if you need the numbers to stay fixed.

    Why does RANDARRAY return a #VALUE! error?

    This commonly happens when whole_number is set to TRUE but min or max aren't whole numbers, or when max is less than min - double-check that your bounds are consistent with the whole_number setting.

    Is RANDARRAY available in all versions of Excel?

    No, it requires Microsoft 365 or Excel 2021 or later - older perpetual versions like Excel 2019 or 2016 don't support it.

    Need to translate a formula using RANDARRAY?

    Use our translator to convert your complete formula