How to Automatically Add Serial Numbers in Google Sheets

Video google sheet row count

If you’re managing data in Google Sheets, there’s a good chance you’ll need to include a column with serial numbers. Though you could manually enter them, that’s time-consuming and inefficient. In this article, I’ll share four simple methods to automatically number rows in Google Sheets so you can save time and effort. Let’s dive in!

Numbering Rows in Google Sheets

Here are four effective ways to add serial numbers to your Google Sheets:

  1. Using the Fill handle
  2. Using the ROW function
  3. Using the COUNTA function
  4. Adding 1 to the previous serial number

The method you choose will depend on your data structure and preferences. For instance, if you only want serial numbers for non-empty records, some methods may not be suitable. Let’s explore each method in detail.

Using the Fill Handle to Number Rows

When you have a dataset without empty rows, the Fill handle is the simplest way to add serial numbers. Follow these steps:

  1. Insert a column to the left of the “Name” column by right-clicking on any cell in column A and selecting “Insert column.”
  2. (Optional) Give a title to the new column and format it like the other columns.
  3. Enter 1 in cell A2.
  4. Enter 2 in cell A3.
  5. Select both cells.
  6. Place the cursor in the bottom right corner of the selection. The cursor will transform into a “plus” icon (this is the Fill handle).
  7. Double-click with the mouse (or left-click and drag) to fill the numbers to your desired range.

These steps will automatically generate serial numbers in the additional column you inserted. You can further format this column to improve its visual appeal.

data numbered

Please note that this method works only for continuous datasets without empty rows. If there’s an empty row within the dataset, the Fill handle will only fill numbers up to the previous record.

Using the ROW Function to Number Rows

The ROW function in Google Sheets provides the row number of a given cell reference. By making a slight adjustment, you can use it to get serial numbers in a column. Let’s walk through the steps:

  1. Insert a column to the left of the “Name” column by right-clicking on any cell in column A and selecting “Insert column.”
  2. (Optional) Give a title to the new column.
  3. Enter the formula =ROW()-1 in cell A2.
  4. Copy and paste this formula to all cells where you want the serial numbers.

The above formula utilizes the ROW function to fetch the current row number and subtracts 1 because we start counting from the second row. If you want to start from the first row, simply use the ROW function without any adjustments.

If you only want to display the serial number for filled records, employ the following formula:

=IF(B2<>"",ROW()-1,"")

You can use this formula across multiple cells in the column, even if there are no records yet. As soon as you add a new record, the serial number will automatically appear.

The formula uses the IF function to check if there is text in the adjacent cell (using the ISBLANK function). If it’s blank, the formula returns an empty cell; otherwise, it returns the row number.

The benefit of using the ROW function is that it adjusts automatically if you delete a row from the dataset, giving you the correct row number.

Using the COUNTA Function

Another method to number rows in Google Sheets involves using the COUNTA function. Unlike the ROW function, this function counts only non-empty cells and assigns a serial number only when the row is filled. Here’s how you can do it:

  1. Suppose you have a dataset and want to assign a row number (serial number) to each filled row.
  2. Use the following formula: =IF(ISBLANK(B2),"",COUNTA($B$2:B2))

In this formula, the IF function checks if the adjacent cell is blank (using the ISBLANK function). If it’s blank, the formula returns an empty cell; if it’s not, it counts all the filled rows in the specified range and assigns the number accordingly.

Note the use of $B$2:B2 as the range. The dollar sign before the column alphabet and row number locks the first cell (B2), allowing you to extend the range when copying it to other cells. For example, if you copy the formula to cell B5, the range will automatically adjust to $B$2:B5.

Adding 1 to the Previous Serial Number

If your dataset doesn’t contain empty rows, adding 1 to the previous serial number is a quick and easy method to add serial numbers to a column. Follow these steps:

  1. Enter 1 in cell A2.
  2. In cell A3, enter the formula =A2+1.
  3. Copy and paste this formula for all cells in the column where you want the numbers.

The formula simply adds 1 to the number in the previous cell.

However, please be aware of a few downsides before using this method:

  • It assigns a number to every row, regardless of emptiness.
  • If you delete a row, all values below will return a reference error (#REF!).
  • When you insert a new row, the row number won’t update automatically. You’ll have to copy and paste the formula for all cells in the new row and those below it.

There you have it – four methods to number rows in Google Sheets. Choose the one that best suits your data structure. If your dataset contains empty rows, the COUNTA method is recommended.

I hope you found this tutorial useful! For more Google Sheets tips and tricks, head over to Crawlan.com!

Related posts