SHORTCUTS & FASTER WORKFLOWS

Number Visible Rows in Excel After Filtering

Use one SUBTOTAL formula to number only the records that remain visible. Filter a task list, keep the numbers in order, and skip rows you hide manually, with a free workbook.

Number visible rows in Excel after filtering with SUBTOTAL 103, showing open tasks renumbered from 1 through 10.
The visible task list restarts at 1 and stays in sequence as you filter it.

Quick answer: use SUBTOTAL with COUNTA

To number visible rows in Excel, put this formula in the first data row of a helper column, then fill it down:

=SUBTOTAL(103,$C$5:C5)

Here, column C contains a task name on every record. When you filter the list, SUBTOTAL ignores rows the filter removes and counts the nonblank task names that are still visible. The first visible task is 1, the second is 2, and so on. The number changes with the current view, so keep the Task ID as the permanent identifier.

Free download: Get the visible-row numbering workbook (.xlsx). It includes a 20-row task list, working formulas, an AutoFilter, and a How It Works sheet.

What the workbook shows

The sample list is a small finance team’s task register. It has 20 records, from REQ-101 to REQ-120, with a task name, owner, status, priority and due date. The visible number sits in column A; the ID in column B stays fixed even when you filter or sort. With Status set to Open, 10 tasks remain and the formula numbers them 1 through 10.

ColumnFieldPurpose
AVisible #Temporary sequence for the rows in the current view
BTask IDPermanent record key such as REQ-101
CTaskNonblank text counted by SUBTOTAL
D:GOwner, Status, Priority, Due dateFields used to filter the list
The helper number is a viewing aid; Task ID is what identifies each record.

Excel’s SUBTOTAL function supports 11 operations. Function number 3 runs COUNTA, which counts nonempty cells. Function number 103 runs the same count while also excluding manually hidden rows. Both 3 and 103 ignore rows excluded by an AutoFilter. See the Microsoft SUBTOTAL reference for the full function-number table.

Step 1: Set up a clean list

Put one task on each row. Keep the column headings in row 4 and the records directly below them, as in the sample workbook. The example uses A4:G24:

  1. Enter Visible #, Task ID, Task, Owner, Status, Priority and Due date in A4:G4.
  2. Enter one complete record per row in rows 5 through 24. Do not leave the Task cell in column C blank.
  3. Select A4:G24 and turn on filters with Ctrl+Shift+L on Windows. On a Mac, use the Data > Filter command. The filter shortcut guide covers turning AutoFilter on and off.
Excel task list in A4:G10 with headings for Visible number, Task ID, Task, Owner, Status, Priority and Due date.
Use a single header row and keep a value in the column the formula will count.
Checkpoint: Every record should have a Task ID in column B and a task name in column C. A blank in the counted column makes COUNTA skip that record.

Step 2: Add a helper column for the visible number

Use column A for the temporary sequence and leave column B for your real Task ID. This distinction matters: a filtered list can show REQ-101, REQ-103 and REQ-105 as visible rows 1, 2 and 3. If you used the row number as an ID, those records would appear to change identity every time someone filtered the list.

  1. In A4, type Visible #.
  2. Keep the permanent identifier in B, such as REQ-101.
  3. Freeze the header if helpful: click A5, then choose View > Freeze Panes > Freeze Panes.
Excel task list showing a separate Visible number helper column before the permanent Task ID column.
The helper sequence can change; the Task ID remains the stable reference.

Step 3: Enter the SUBTOTAL formula

Click A5, the first data cell under Visible #, and enter:

=SUBTOTAL(103,$C$5:C5)
Excel cell A5 with formula =SUBTOTAL(103,$C$5:C5), counting nonblank task names in column C.
The first visible task returns 1 because its name is the first nonblank visible cell in the range.

There are three important pieces:

PartMeaning
103COUNTA, with manually hidden rows excluded too
$C$5Locks the start of the count at the first task name
C5Moves down as the formula is copied to the next row

In the unfiltered workbook, A5 returns 1. The dollar signs lock only the starting cell, while the last reference remains relative. In A6 the formula becomes =SUBTOTAL(103,$C$5:C6), so Excel counts from the first task through the current row.

Step 4: Fill the formula down the list

Copy A5 to A24. You can drag the fill handle down, double-click it when the adjacent Task column is filled, or select A5:A24 and press Ctrl+D. On a Mac, use Command+D.

Excel task rows numbered 1 through 6, with the formula ending reference extending from C5 to C10.
The locked starting point stays at C5 while the ending row advances.
Checkpoint: With every row visible, A5:A24 should show the numbers 1 through 20. If the values repeat, the range’s starting cell may be moving; use $C$5 as the locked start.

For a list that grows, convert the range to an Excel Table before entering the formula. Press Ctrl+T, confirm that the table has headers, and enter the formula in the first cell of the Visible # column. Excel fills the calculated column as records are added. For ordinary ranges, extend both the filter range and the formula when you add rows.

Step 5: Filter the list and watch the numbers reset

Open the filter arrow in E4 (Status), clear Select All, select Open, and confirm. Ten rows remain. The visible numbers in column A now run from 1 to 10, even though their original worksheet rows are not consecutive.

Excel task list filtered to Open status, with ten matching tasks renumbered consecutively from 1 through 10.
Filter Status to Open: the ten matching records form a clean numbered list.

Try another filter, such as Priority = High. The sequence recalculates for the visible records. Clear the filter to restore the complete 1-to-20 list. If your filter controls are missing, use the ribbon’s Data > Filter command or toggle AutoFilter with the shortcut above.

When you need to copy only the filtered results to a new sheet, Excel has a separate Visible cells only command. The numbering formula does not hide or delete records; it only recalculates the helper values.

Step 6: Decide whether manually hidden rows count

Use 103 when a row hidden with Home > Format > Hide & Unhide > Hide Rows should disappear from the numbering too. If you want manually hidden rows to remain in the count while filtered-out records are still ignored, use 3 instead:

=SUBTOTAL(3,$C$5:C5)
Formula comparison for SUBTOTAL function numbers 3 and 103, showing that 103 excludes manually hidden rows.
Choose 103 to ignore manually hidden rows as well as rows removed by a filter.

The sample workbook uses 103. Its what-if check hides worksheet row 5; the next visible row’s formula returns 1. With 3, that manually hidden task would still count. Both codes always ignore rows excluded by an AutoFilter.

Common problems and quick fixes

What you seeLikely causeFix
Numbers skip after filteringThe formula counts a column with blanksUse a field filled on every row, such as Task ID in column B, or fill in the Task cells in C.
The number does not change when a row is hidden manuallyThe formula uses function number 3Use 103 when manual hiding should be excluded.
Every visible row shows 1The formula start moves with each copied rowLock the starting cell: $C$5.
The sequence stops before the last recordThe formula or AutoFilter range ends earlyFill the formula to the last record and extend the filter range.
The numbers are treated as permanent referencesA temporary row number is being used as an IDKeep a unique Task ID or invoice number in a separate column.

If you work with long worksheets, the Ctrl+Arrow navigation guide helps you jump to the edge of a contiguous data block. For a dynamic sorted output, see how to sort data with SORTBY.

Frequently asked questions

Does SUBTOTAL ignore filtered rows?

Yes. SUBTOTAL ignores rows excluded by an AutoFilter for every supported function number, including 3 and 103. The 103 version also excludes rows hidden manually.

Should I use 3 or 103 in the formula?

Use 103 if manually hidden rows should not count. Use 3 if those rows should remain in the sequence. Both versions ignore rows filtered out of the list.

Can I count visible numeric IDs instead of text?

Yes. Use function number 102 for COUNT, or 2 if manually hidden numeric values should still count. For example: =SUBTOTAL(102,$B$5:B5).

Will the visible numbers stay the same after sorting?

No. They describe the current order and visible subset. The Task ID remains the stable key, so use that field in lookups, notes and other sheets.

Does this work in Excel for the web and older versions?

This example uses AutoFilter and a standard SUBTOTAL formula in desktop Excel and Excel for the web. It does not require a recent dynamic-array function.

Final checklist

  • Each task occupies one row and the chosen count column is populated.
  • The helper formula starts at the first record and locks the range start.
  • Function number 103 is used when manual hidden rows must be excluded.
  • The sequence changes when a filter is applied and restores to 1 through 20 when cleared.
  • A separate permanent ID identifies each task.
Practice file: Download the visible-row numbering workbook. The How It Works sheet explains the formula and the manual-hide test.

Make filtered lists easier to review

Browse the OneXcel Tutorial Hub for more practical Excel guides, explore ready-to-use Excel templates, or turn your reports into dashboards with the OneXcel Dashboard Builder.

Discover more from OneXcel Studio

Subscribe now to keep reading and get access to the full archive.

Continue reading