SEQUENCE Function – Breakdown

 

SEQUENCE function is one of the most advanced and modern functions of Excel.

It was introduced as a part of the dynamic array tools and is only accessible to Microsoft 365 users.

We always keep our software up to date on our Excel Courses so people get to use it!

To learn more about this intelligent array tool, continue reading.

Excel SEQUENCE Function

SEQUENCE function in Excel is one of the dynamic array functions introduced through Microsoft 365. It is only available in Excel 2021 and later versions.

The Excel SEQUENCE function generates a list of sequential numbers organized in the shape of an array. This array can be single or multi-dimensional depending upon the number of rows and columns arguments.

Syntax      

Syntax of the SEQUENCE function reads as follows.

= SEQUENCE ( rows, [columns], [start], [step] )

Arguments

Let’s break down the above arguments to see how each of these works.

  • Rows – This specifies the number of rows to be returned.
  • Columns – This specifies the number of columns to be returned.
  • Start – Optional argument. It enables users to specify the starting point of the range.
  • Step – Optional argument. It enables users to specify the interval between the values in the range.

Return Value

The SEQUENCE function returns a series of sequential values based on the arguments input into the formula. These numbers can be in the form of an array or a range.

Functions Library

You may access the SEQUENCE function from the Functions Library as follows.

Formulas > Functions Library > Math & Trigonometry Functions > SEQUENCE

 

Accessing the SEQUENCE function from the Functions’ Library

This library contains the names and information to help you learn Excel’s best Functions and Formulas.

Why would anyone want to use it?

You may want to use the SEQUENCE function for a wide variety of causes. For instance, if you want to set up a duty chart for your co-workers. Let’s say, each co-worker gets to work for an extra two hours once every week

By specifying the rows as 4, columns as 7, a start and step value, you can set up a work calendar to determine the day each co-worker gets to work extra.

SEQUENCE Use Cases

The SEQUENCE function turns out to be the product of a very intelligent mind. Using this function, you can quickly set a single or multi-dimensional array. A few practical uses of the SEQUENCE function are listed below.

  • A major use of the SEQUENCE function is the setting up of a calendar. Using the SEQUENCE function, you can set up a monthly or yearly calendar in minutes.
  • When combined with other functions such as SUMIF and COUNTIF, the SEQUENCE function can be used to form reports. For instance, if you have the sales records for a year. Sales made during N number of days can be computed using the SEQUENCE function.

N can be any number of days, be it 7, 15, or 30 to be specified as the step value. You can then also create flowcharts in Excel using sequential number series.

  • The SEQUENCE function is largely used for the real-life grouping of items. For example, to draw a sample out of a population, you can put together the SEQUENCE function. It helps you draw every Nth item from a population.

Where N is the interval to be specified.

That broad list of uses of the SEQUENCE function doesn’t end here. It can be used for a variety of tasks, either solely or in combination with other functions. Common functions paired with the SEQUENCE function include TEXT, DATE, TODAY, YEAR, etc.

 

Using SEQUENCE to generate an array of sequential numbers – Examples

To understand this function better, let’s throw together a basic example of how you may use the SEQUENCE Function in Excel.

Basic Example

Let’s begin with a basic two-dimensional array that is 4 rows tall and 7 columns wide. How to do that? To do so, compose the SEQUENCE formula as follows.

= SEQUENCE (4, 7, 1, 1)

 

  • The first argument i.e. rows are set as 4. This is because we want the resultant range to be 4 rows tall.
  • The second argument i.e. columns are set as 7. This is because we want the resultant range to stretch across 7 columns.
  • The third argument i.e. start is set to 1 as we want the range to begin from 1. This argument is an optional one that can also be omitted. Excel would still assume it to be 1 if left vacant.
  • The third argument i.e. step is set to 1 as we want the interval between the values to be 1. This argument is an optional one that can also be omitted. Excel would still assume it to be 1 if left vacant.

The cell where you enter the formula will act as the first cell of the row and column where the range or array is to be populated.

Activate a cell, type in the formula above, and press ‘enter’ to yield results as follows.

Excel creates an array/range of numbers

Using the SEQUENCE function in Excel is only that easy.

More Examples

After we’ve come across a basic example to create a range or array in Excel using the SEQUENCE function, it’s time we move forward. Let us build some more examples to see into the technicalities that come along with the SEQUENCE function.

Positive and Negative Values

Is the SEQUENCE function adaptable to both positive and negative values? Yes, it is. All you need to do is work out the syntax smartly.

For example, let’s build an array that extends from -5 to +5. To do so, here’s how the SEQUENCE function is to be composed.

= SEQUENCE (10, 1, -5, 1)

  • As we want the array to extend from -5 to +5 (that makes a total of 10 numbers), we’ve set the number of rows to 10.
  • The column’s argument is set to 1.
  • The start argument is set to -5.
  • The step argument is set to +1.

Hit ‘Enter’ to see Excel generate a sequential series of numbers ranging from -5 to +5.

Excel creates an array of negative and positive values

 

Value countdown

We have seen how the SEQUENCE function works with generating sequential numbers in ascending order. But what if we need a sequential series of numbers that goes the other way around?

To generate sequential numbers in descending order, the SEQUENCE function needs to be slightly amended as follows.

For instance, to generate an array of descending numbers ranging from 50 to 40, you may set up the SEQUENCE formula as follows.

= SEQUENCE (1, 10, 50, -1)

 

  • The number of rows is set to 1.
  • As we want the array to extend from 50 to 40 (that makes a total of 10 numbers), we’ve set the number of columns to 10.
  • The starting point is set to 50.
  • Each step is set to -1. Every subsequent value will be one less than the previous value.

Hit ‘Enter’ to see Excel generate a series of numbers in descending order.

Excel creates an array of descending sequential values

 

Date Generation

Dates in Excel are only serial numbers. Surprisingly, the beginning point of this series is 01 January 1900. Excel takes the said date equivalent to 1, and every successive day keeps adding to it.

Using the SEQUENCE function, you can create a sequential series of dates and add any number to it. Take a look below.

First date

The image above represents the date when Summer Camps in XYZ School are to begin. They are going to last for good 20 days. To build a series of dates till they continue, write up the SEQUENCE function as follows.

=SEQUENCE (5, 4, D1, 1)

 

  • The number of rows is set to 5 through the first required argument.
  • The number of columns is set to 4 through the second required argument.
  • The starting point is set equivalent to cell D1 where the starting date is populated.
  • The step is set to 1. This being an optional argument may be left vacant.

Hit ‘Enter’ to see the results as follows

Excel generates a series of sequential dates starting from 01 June 2020

 

Excel generates a series of dates beginning from 01 June 2020 up to 20 June 2020.

Pro Tip: If your results look like a list of serial numbers and not dates, that’s because the cells are not rightly formatted. Select them all and change their format to ‘Date’ from the tab Home > Number.

When not formatted as dates, Excel takes the dates as serial numbers instead.

Workdays Generation

Let’s go a step ahead with the same example stipulated above. What if you want to determine only 20 workdays starting from 01 June 2020?

To do so, we need to nest the SEQUENCE into WORKDAY.INTL function, as follows.

= WORKDAY.INTL (D1-1, SEQUENCE (5,4))

  • D1 represents the starting date. The WORKDAY.INTL formula starts counting the working days from the date following the starting date. We have deducted one day from the starting date to combat the same.
  • The SEQUENCE function is set up with 5 rows and 4 columns. The last two optional arguments are omitted and would be set to 1 by Excel by default.

Excel generates a series of twenty workday dates starting from 01 June 2022

This generates twenty workdays starting from 01 June 2022. The WORKDAY.INTL automatically excludes Saturdays and Sundays being weekends.

 

If you get a different result, we recommend you audit the formula to see just where it went wrong.

More about the SEQUENCE function:

This is not it. You can nest the SEQUENCE function into many other Excel functions to yield a variety of useful results.

You may use it together with TEXT, EDATE, INDEX, SUMPRODUCT, DATE function, and so many more functions.

Knowing how to Recovering Unsaved Files is very important here, using functions together can cause crashes with older systems!

SEQUENCE Troubleshooting

The SEQUENCE function itself is a relatively straightforward function where you are likely not to confront problems.

However, a few common problems faced by users are enumerated below.

1.   The #SPILL! Error

If you are new to the dynamic array functions, the #SPILL! error may sound alien to you. Don’t fret if Excel returns you the same when operating the SEQUENCE function.

The SEQUENCE function returns an array or range of numbers split into multiple columns and rows (as defined through the arguments).

Let’s say you formulate the SEQUENCE function in Cell B2 that is 4 rows tall and 5 columns wide. This would stretch the resultant array from cell B2 to cell F5.

If any cell in between this range (B2 to F5) is not vacant to populate the resulting range, Excel would pose the #SPILL! error.

For instance, in the image below, Excel gives back #SPILL! error as Cell C3 already consists of content.

Excel gives back the #SPILL error

To deal with the said error, remove the data in cell C3 and try again as follows.

Excel generates the desired series of sequential numbers

2.   The #VALUE! Error

All the arguments within the SEQUENCE function tend to be numeric values. If any of these arguments is configured as a text value, Excel would return the #VALUE! Error.

To resolve the same, recheck the SEQUENCE formula to look out for any text arguments.

Conclusion:

The examples above emphasize how the SEQUENCE function works. Also, once you are good at nesting the SEQUENCE function into other functions, you can work out this array tool endlessly.

Practice the above examples to master the array tools of Excel.

About Ben Richardson

Ben is a director of Acuity Training which he has been running for over 10 years.


He is a Natural Sciences graduate from the University of Cambridge and a qualified accountant with the ICAEW.


He previously worked as a venture capitalist and banker and so had extensive experience with Excel from building financial models before moving to learn SQL, Microsoft Power BI and other technologies more recently.