Generating a Range of Sequential Numbers
August 22, 2022 - by Bill Jelen
I have a cool trick in my Power Excel seminars where I show how you can Ctrl + drag the fill handle from a cell with the number 1, and Excel will extend to 2, 3, 4. It is an obscure trick, and not many people know it. When I first saw the SEQUENCE
function, I thought it might be for people who had never discovered this trick. But as you will see here, the SEQUENCE
function is the key to making many other Excel functions into array functions.
SEQUENCE
generates an array of numbers. The syntax is =SEQUENCE(rows, [columns], [start], [step])
.
While =SEQUENCE(10)
generates 1 through 10, you can customize the numbers with =SEQUENCE(10,3,5,10)
to generate a 10-row by 3-column array starting at 5 and stepping by 10.
The RANDARRAY
function is great for driving Monte Carlo analysis. To use it, you just specify how many rows and columns of random numbers you want.
A March 2019 improvement to RANDARRAY
allows you to specify a min and max and also that you only want integers.
This article is an excerpt from Power Excel With MrExcel
Title photo by Jeffrey Brandjes on Unsplash