Skip to content
Free Excel Tutorials
  • Home
  • Excel For Beginners
  • Excel Intermediate
  • Advanced Excel For Experts

Data Analysis

  • Chart Axes in Excel
  • How to create running total in an Excel Table
  • What-If Analysis: Scenarios and Goal Seek in Excel
  • How To Filter Data in Excel
  • How to create Gauge Chart in Excel

References

  • How to get address of last cell in range in Excel
  • Lookup entire row in Excel
  • How to get last row in mixed data with blanks in Excel
  • How to get first row number in range in Excel
  • Basic INDEX MATCH approximate in Excel

Data Validations

  • Excel Data validation exists in list
  • How To Create Drop-down List in Excel
  • Excel Data validation must begin with
  • Excel Data validation must not contain
  • Prevent invalid data entering in specific cells

How to add sequential row numbers to a set of data in Excel

by

To add sequential row numbers to a set of data with a formula, you can use the ROW function. See example below:

Formula

=ROW()-offset

Explanation

In the example shown, the formula in B5 is:

=ROW()-4

How this formula works

When not given a reference, the ROW function returns the row number of the current row. In cell B5, ROW returns 5, in cell B6, ROW() returns 6, and so on:

=ROW() // returns 5 in B5
=ROW() // returns 6 in B6

So, to create sequential row numbers beginning with 1, we subtract 4:

=ROW()-4 // returns 1 in B5
=ROW()-4 // returns 2 in B6

This formula will continue to work as long as rows are not added or deleted above the first row of data. If rows are added or deleted above the data, the hardcoded offset value 4 will need to be adjusted as needed.

Worked Example:   How to get address of first cell in range in Excel

Row numbers in a Table

If we convert the data to a proper Excel Table we can use a more robust formula. Below, we have the same data in “Table1”:

Worked Example:   How to count total columns in range in Excel

The formula in B5, copied down, is:

=ROW()-ROW(Table1)+1

Here, instead of subtracting a hardcoded offset, we calculate the correct offset with this expression:

ROW(Table1)+1

Because the ROW function returns the the first row of table data (not including the header), we need to add 1 to start row numbering at 1. This formula will continue to work correctly when the table is moved, or when rows are inserted or deleted above the table.

Worked Example:   Highlight every other row in Excel

Post navigation

Previous Post:

How to generate random date between two dates in Excel

Next Post:

Popularly Used Excel Functions and their examples

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Learn Basic Excel

Ribbon
Workbook
Worksheets
Format Cells
Find & Select
Sort & Filter
Templates
Print
Share
Protect
Keyboard Shortcuts

Categories

  • Charts
  • Data Analysis
  • Data Validation
  • Excel Functions
    • Cube Functions
    • Database Functions
    • Date and Time Functions
    • Engineering Functions
    • Financial Functions
    • Information Functions
    • Logical Functions
    • Lookup and Reference Functions
    • Math and Trig Functions
    • Statistical Functions
    • Text Functions
    • Web Functions
  • Excel VBA
  • Excel Video Tutorials
  • Formatting
  • Grouping
  • Others

Logical Functions

  • OR function: Description, Usage, Syntax, Examples and Explanation
  • SWITCH function: Description, Usage, Syntax, Examples and Explanation
  • NOT function: Description, Usage, Syntax, Examples and Explanation
  • OR function Examples in Excel
  • IF function: Description, Usage, Syntax, Examples and Explanation

Date Time

  • DATEDIF function: Description, Usage, Syntax, Examples and Explanation
  • Add workdays to date custom weekends in Excel
  • Get days, hours, and minutes between dates in Excel
  • Add workdays no weekends in Excel
  • How to get year from date in Excel

Grouping

  • How to randomly assign people to groups in Excel
  • If cell contains one of many things in Excel
  • Running count group by n size in Excel
  • Group numbers at uneven intervals in Excel
  • Group times into unequal buckets in Excel

General

  • Print Excel Sheet In Landscape Or Portrait
  • Basic numeric sort formula in Excel
  • How to generate random date between two dates in Excel
  • Cell References: Relative, Absolute and Mixed Referencing Examples
  • How to create dynamic named range with INDEX in Excel
© 2023 xlsoffice . All Right Reserved. | Teal Smiles | Abbreviations And Their Meaning