All Things Newz
Technology

How to Use the SEQUENCE Function in Google Sheets


Filling sequential data in Google Sheets is easy using the fill feature. But if you want to increase or decrease the numbers in your series or fill all cells in an array, consider the SEQUENCE function.

While the SEQUENCE function can perform much the same way as the fill feature, it’s the optional arguments that make it most useful. Want to fill both columns and rows in a range? Want to start at 525 and decrease each number by 18? How about doing both of these using dates? These are the types of things you can do with the SEQUENCE function in Google Sheets.

About the SEQUENCE Function

The syntax for the function is SEQUENCE(rows, columns, start, step) where only the first argument is required.

SEQUENCE function syntax in Google Sheets

Rows: The number of rows you want to fill.

Columns: The number of columns you want to fill. If omitted, the formula assumes one column.

Start: The number to begin the sequence. If omitted, the formula starts at 1.

Step: The amount to increase or decrease each number in the series. If omitted, the formula increases each number by 1.

Use the SEQUENCE Function

Let’s take a look at how to use the SEQUENCE function with each of its arguments.

For a simple sequence of numbers filling 10 rows in one column using the defaults for the optional arguments, you’d use this formula:

=SEQUENCE(10)

SEQUENCE formula for rows only

For a sequence of numbers filling 10 rows and two columns using the defaults for the other two optional arguments, you would use this formula:

=SEQUENCE(10,2)

Notice the direction of the series. It fills to the right, then down to the left and to the right again, like reading a paragraph.

SEQUENCE formula for rows and columns

For a sequence filling the same number of rows and columns but starting with number 35, you would use this formula:

=SEQUENCE(10,2,35)

SEQUENCE formula with a starting number

For a sequence filling the same number of rows and columns, starting with 35, and increasing each number by 10, you’d use this formula:

=SEQUENCE(10,2,35,10)

SEQUENCE formula with the increase argument

To decrease that same series of numbers by 10 instead of increasing it, you would use this formula:

=SEQUENCE(10,2,35,-10)

SEQUENCE formula with the decrease argument

SEQUENCE With Cell References

You can also use cell references for the start and step arguments if you like. For example, we’ll fill 10 rows and two columns starting with the value in cell B2 which is 5:

=SEQUENCE(10,2,B2)

SEQUENCE formula with a cell reference

And here, we’ll use those same arguments and increase each number by the value in cell B1 which is 25:

=SEQUENCE(10,2,B2,B1)

SEQUENCE formula with a cell reference for increase

You can add the minus sign in front of the step cell reference to decrease the numbers by the value in cell B1:

=SEQUENCE(10,2,B2,-B1)

SEQUENCE formula with a cell reference for decrease

SEQUENCE With Dates

One disadvantage to the SEQUENCE function is that you cannot use it to fill text, like letters. But if you need to fill a series of dates, it works.

RELATED: How to Change the Default Date Format in Google Sheets

Here, we’ll fill 10 rows and two columns with dates starting with 1/1/2022. Notice the date argument is in quotes.

=SEQUENCE(10,2,"1/1/2022")

SEQUENCE formula for dates

Now, we’ll increase the series of dates by 10 days:

=SEQUENCE(10,2,"1/1/2022",10)

SEQUENCE formula for increasing dates

If you need to fill text, formulas, months, or days, the fill feature is ideal. But if you need to fill a series of numbers for an out-of-the-ordinary situation, check out the SEQUENCE function in Google Sheets.





Source link

Related posts

How to Run Commands Inside Kubernetes Pod Containers

Horace Hayward

This Raspberry Pi-Powered Black and White Tube TV Plays Modern Movies – Review Geek

Horace Hayward

The Next Big Zelda Game Finally Has a Name and Release Date

Horace Hayward