---
title: "ROW function in Excel: syntax and examples | PracticeExcel"
description: "How to use ROW in Excel and Google Sheets: row numbers, automatic numbering that survives sorting, and shading every other row."
canonical_url: "https://practiceexcelonline.com/functions/row"
locale: en
meta:
  "og:description": "How to use ROW in Excel and Google Sheets: row numbers, automatic numbering that survives sorting, and shading every other row."
  "og:image": "https://practiceexcelonline.com/_og/d/c_Page%2Ctitle_~Uk9XIGZ1bmN0aW9uIGluIEV4Y2VsOiBzeW50YXggYW5kIGV4YW1wbGVz%2Cdescription_~SG93IHRvIHVzZSBST1cgaW4gRXhjZWwgYW5kIEdvb2dsZSBTaGVldHM6IHJvdyBudW1iZXJzLCBhdXRvbWF0aWMgbnVtYmVyaW5nIHRoYXQgc3Vydml2ZXMgc29ydGluZywgYW5kIHNoYWRpbmcgZXZlcnkgb3RoZXIgcm93Lg%2Ceyebrow_Excel%2Bfunctions%2Csite_practiceexcel%2Ccode_~Uk9XKFtyZWZlcmVuY2VdKQ%2Cp_Ii9mdW5jdGlvbnMvcm93Ig%2Cs_rQYJ7IzA0kKHGk1l.png"
  "og:image:height": "600"
  "og:image:type": image/png
  "og:image:width": "1200"
  "og:title": "ROW function in Excel: syntax and examples | PracticeExcel"
  "twitter:image": "https://practiceexcelonline.com/_og/d/c_Page%2Ctitle_~Uk9XIGZ1bmN0aW9uIGluIEV4Y2VsOiBzeW50YXggYW5kIGV4YW1wbGVz%2Cdescription_~SG93IHRvIHVzZSBST1cgaW4gRXhjZWwgYW5kIEdvb2dsZSBTaGVldHM6IHJvdyBudW1iZXJzLCBhdXRvbWF0aWMgbnVtYmVyaW5nIHRoYXQgc3Vydml2ZXMgc29ydGluZywgYW5kIHNoYWRpbmcgZXZlcnkgb3RoZXIgcm93Lg%2Ceyebrow_Excel%2Bfunctions%2Csite_practiceexcel%2Ccode_~Uk9XKFtyZWZlcmVuY2VdKQ%2Cp_Ii9mdW5jdGlvbnMvcm93Ig%2Cs_rQYJ7IzA0kKHGk1l.png"
---

> Index of every page on this site: [llms.txt](https://practiceexcelonline.com/llms.txt)

# **The ROW function**

Returns the row number of a cell. Left empty, it returns the row of the cell the formula is in.

=

ROW(

## **Syntax**

```
ROW([reference])
```

<dl><dt>**reference **(optional)</dt>
<dd>The cell to get the row number of. Left out, the formula's own cell.</dd></dl>

## **Examples**

B1=ROW(C7)

|  | A | B |
| --- | --- | --- |
| 1 |  | **7** |

A4=ROW()-1

|  | A | B |
| --- | --- | --- |
| 1 |  | Name |
| 2 |  | Ann |
| 3 |  | Ben |
| 4 | **3** | Cy |

B6=IF(MOD(ROW(),2)=0,"Even row","Odd row")

|  | A | B |
| --- | --- | --- |
| 1 |  | |
| 2 |  | |
| 3 |  | |
| 4 |  | |
| 5 |  | |
| 6 |  | **Even row** |

## **Read the guide**

- [**Conditional formatting in Excel: highlight cells and rows with rules and formulas**](https://practiceexcelonline.com/learn/conditional-formatting-excel)

## **Questions**

<details>

<summary>

### How do I number rows automatically?

</summary>

In row 2, type =ROW()-1 and fill it down. The numbers stay right when you delete or insert rows. In Excel 365 you can also spill them with SEQUENCE.

</details>

<details>

<summary>

### What is the difference between ROW and ROWS?

</summary>

ROW returns the row number of a cell, so ROW(C7) is 7. ROWS counts the rows in a range, so ROWS(C2:C7) is 6.

</details>

## **Related functions**

- [**COLUMN**](https://practiceexcelonline.com/functions/column)
- [**INDEX**](https://practiceexcelonline.com/functions/index)
- [**MOD**](https://practiceexcelonline.com/functions/mod)
- [**SEQUENCE**](https://practiceexcelonline.com/functions/sequence)

```json
{"@context":"https://schema.org","@graph":[{"@id":"https://practiceexcelonline.com/#identity","@type":"Organization","name":"PracticeExcel","url":"https://practiceexcelonline.com/","logo":{"@id":"https://practiceexcelonline.com/#logo"}},{"@id":"https://practiceexcelonline.com/#website","@type":"WebSite","inLanguage":"en-US","name":"PracticeExcel","url":"https://practiceexcelonline.com/","alternateName":["Practice Excel Online","PracticeExcelOnline.com"],"publisher":{"@id":"https://practiceexcelonline.com/#identity"},"workTranslation":{"@id":"https://excelopgaver.dk/#website"}},{"@id":"https://practiceexcelonline.com/functions/row#webpage","description":"How to use ROW in Excel and Google Sheets: row numbers, automatic numbering that survives sorting, and shading every other row.","name":"ROW function in Excel: syntax and examples","url":"https://practiceexcelonline.com/functions/row","@type":["WebPage","FAQPage"],"breadcrumb":{"@id":"https://practiceexcelonline.com/functions/row#breadcrumb"},"isPartOf":{"@id":"https://practiceexcelonline.com/#website"},"mainEntity":[{"@id":"https://practiceexcelonline.com/functions/row#/schema/question/1"},{"@id":"https://practiceexcelonline.com/functions/row#/schema/question/2"}],"potentialAction":[{"@type":"ReadAction","target":["https://practiceexcelonline.com/functions/row"]}],"primaryImageOfPage":{"@id":"https://practiceexcelonline.com/#logo"}},{"@id":"https://practiceexcelonline.com/functions/row#breadcrumb","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","name":"Home","item":"https://practiceexcelonline.com","position":1},{"@type":"ListItem","name":"Excel functions","item":"https://practiceexcelonline.com/functions","position":2},{"@type":"ListItem","name":"ROW function in Excel: syntax and examples","position":3}]},{"@id":"https://practiceexcelonline.com/functions/row#article","description":"How to use ROW in Excel and Google Sheets: row numbers, automatic numbering that survives sorting, and shading every other row.","headline":"ROW function in Excel: syntax and examples","inLanguage":"en-US","thumbnailUrl":"https://practiceexcelonline.com/_og/d/c_Page%2Ctitle_~Uk9XIGZ1bmN0aW9uIGluIEV4Y2VsOiBzeW50YXggYW5kIGV4YW1wbGVz%2Cdescription_~SG93IHRvIHVzZSBST1cgaW4gRXhjZWwgYW5kIEdvb2dsZSBTaGVldHM6IHJvdyBudW1iZXJzLCBhdXRvbWF0aWMgbnVtYmVyaW5nIHRoYXQgc3Vydml2ZXMgc29ydGluZywgYW5kIHNoYWRpbmcgZXZlcnkgb3RoZXIgcm93Lg%2Ceyebrow_Excel%2Bfunctions%2Csite_practiceexcel%2Ccode_~Uk9XKFtyZWZlcmVuY2VdKQ%2Cp_Ii9mdW5jdGlvbnMvcm93Ig%2Cs_rQYJ7IzA0kKHGk1l.png","@type":["Article","TechArticle"],"author":{"@id":"https://practiceexcelonline.com/#identity"},"image":{"@id":"https://practiceexcelonline.com/#/schema/image/1"},"isPartOf":{"@id":"https://practiceexcelonline.com/functions/row#webpage"},"mainEntityOfPage":{"@id":"https://practiceexcelonline.com/functions/row#webpage"},"publisher":{"@id":"https://practiceexcelonline.com/#identity"}},{"@id":"https://practiceexcelonline.com/functions/row#/schema/question/1","@type":"Question","inLanguage":"en-US","name":"How do I number rows automatically?","acceptedAnswer":{"@type":"Answer","text":"In row 2, type =ROW()-1 and fill it down. The numbers stay right when you delete or insert rows. In Excel 365 you can also spill them with SEQUENCE."}},{"@id":"https://practiceexcelonline.com/functions/row#/schema/question/2","@type":"Question","inLanguage":"en-US","name":"What is the difference between ROW and ROWS?","acceptedAnswer":{"@type":"Answer","text":"ROW returns the row number of a cell, so ROW(C7) is 7. ROWS counts the rows in a range, so ROWS(C2:C7) is 6."}},{"@id":"https://practiceexcelonline.com/#logo","@type":"ImageObject","caption":"PracticeExcel","contentUrl":"https://practiceexcelonline.com/brand/practiceexcel/icon-512.png","inLanguage":"en-US","url":"https://practiceexcelonline.com/brand/practiceexcel/icon-512.png"},{"@id":"https://practiceexcelonline.com/#/schema/image/1","@type":"ImageObject","contentUrl":"https://practiceexcelonline.com/_og/d/c_Page%2Ctitle_~Uk9XIGZ1bmN0aW9uIGluIEV4Y2VsOiBzeW50YXggYW5kIGV4YW1wbGVz%2Cdescription_~SG93IHRvIHVzZSBST1cgaW4gRXhjZWwgYW5kIEdvb2dsZSBTaGVldHM6IHJvdyBudW1iZXJzLCBhdXRvbWF0aWMgbnVtYmVyaW5nIHRoYXQgc3Vydml2ZXMgc29ydGluZywgYW5kIHNoYWRpbmcgZXZlcnkgb3RoZXIgcm93Lg%2Ceyebrow_Excel%2Bfunctions%2Csite_practiceexcel%2Ccode_~Uk9XKFtyZWZlcmVuY2VdKQ%2Cp_Ii9mdW5jdGlvbnMvcm93Ig%2Cs_rQYJ7IzA0kKHGk1l.png","inLanguage":"en-US","url":"https://practiceexcelonline.com/_og/d/c_Page%2Ctitle_~Uk9XIGZ1bmN0aW9uIGluIEV4Y2VsOiBzeW50YXggYW5kIGV4YW1wbGVz%2Cdescription_~SG93IHRvIHVzZSBST1cgaW4gRXhjZWwgYW5kIEdvb2dsZSBTaGVldHM6IHJvdyBudW1iZXJzLCBhdXRvbWF0aWMgbnVtYmVyaW5nIHRoYXQgc3Vydml2ZXMgc29ydGluZywgYW5kIHNoYWRpbmcgZXZlcnkgb3RoZXIgcm93Lg%2Ceyebrow_Excel%2Bfunctions%2Csite_practiceexcel%2Ccode_~Uk9XKFtyZWZlcmVuY2VdKQ%2Cp_Ii9mdW5jdGlvbnMvcm93Ig%2Cs_rQYJ7IzA0kKHGk1l.png"}]}
```

## Sitemap

See the full [sitemap](https://practiceexcelonline.com/sitemap.md) for all pages.
