Tip: Other languages are Google-Translated. You can visit the English version of this link.
Log in
x
or
x
x
Register
x

or

How to fill down sequence numbers skip hidden rows in Excel?

Supposing, you have a filter data range which you want to fill down sequence numbers into the filtered blank cell as following screenshot shown. In this case, dragging the fill handle will not fill the cells correctly generally, this article, I will talk about some good tricks for solving this task in Excel.

doc fill down skip hidden 1  2 doc fill down skip hidden 2

Fill down sequence numbers skip hidden rows with formula

Fill down sequence numbers skip hidden rows with VBA code

Fill down sequence numbers skip hidden rows with Kutools for Excel


Fill down sequence numbers skip hidden rows:

Kutools for Excel’s Insert Sequence Number utility can help you quickly insert unique sequential numbers into a range of cells or a filtered list, it also can insert sequence into merged cells as you need.

doc-renumber-filter-8-8

Kutools for Excel: with more than 200 handy Excel add-ins, free to try with no limitation in 60 days. Download and free trial Now!



To fill down sequence numbers only to the visible cells, a simple formula may help you, please do as follows:

1. Enter this formula: =SUBTOTAL(103,$B$3:$B3)(B3 is the visible cell which corresponding to the cell that you want to start filling the sequence number to ) into the first cell where you want to fill sequence numbers, A3, for this instance, and then press Enter key, you will get a number 1, see screenshot:

doc fill down skip hidden 3

2. Then select cell A3, and drag the fill handle down to the cells that you want to fill the sequence numbers, see screenshot:

doc fill down skip hidden 4


The following VBA code also can help you to fill the sequence numbers into only visible cells, please do as this:

1. Hold down the ALT + F11 keys to open the Microsoft Visual Basic for Applications window.

2. Click Insert > Module, and paste the following code in the Module Window.

VBA code: Fill down sequence numbers skip hidden rows:

Sub FillValue()
'updateby Extendoffice 20151228
    Dim xRg As Range
    Dim xCell As Range
    Dim xTxt As String
    Dim xVal As Long
    Dim I As Long
    On Error Resume Next
    xTxt = ActiveWindow.RangeSelection.Address
    Set xRg = Application.InputBox("Please select the data range", "Kutools for Excel", xTxt, , , , , 8)
    Set xRg = xRg.SpecialCells(xlVisible)
    Debug.Print xRg.Address
    If xRg Is Nothing Then Exit Sub
    For Each xCell In xRg
        xVal = xVal + 1
        xCell = xVal
    Next
End Sub

3. Then press F5 key to run this code, and a prompt box is popped out to remind you select the data range that you want to fill, see screenshot:

doc fill down skip hidden 5

4. And then click OK button, the sequence numbers have been filled into the visible cells only.


Above two methods only can help you to fill down the sequence numbers into the visible cells, if you want to fill sequence as AA-0001-BB, AA-0002-BB,AA-0003-BB…, the above methods will not work. But, please don’t worry about, Kutools for Excel’s Insert Sequence Number utility can help you finish it quickly and easily.

Kutools for Excel : with more than 300 handy Excel add-ins, free to try with no limitation in 60 days

After installing Kutools for Excel, please do as follows:

1. Select the cells that you want to fill sequence strings.

2. Click Kutools > Insert > Insert Sequence Number, in the Insert Sequence Number dialog box, click New button, see screenshots:

doc fill down skip hidden 6  2 doc fill down skip hidden 7

3. In the expanded dialog box, please specify the settings as your needed into the left bottom section, at the same time, you can preview the sequence in the right bottom pane, see screenshot:

doc fill down skip hidden 8

4. After finishing the settings, click Add button to save this new item into the above list box, see screenshot:

doc fill down skip hidden 9

6. And then select the item you are created and click Fill Range button, the sequence strings have been filled into only the visible cells, see screenshot:

doc fill down skip hidden 10

Download and free trial Kutools for Excel Now !


Kutools for Excel: with more than 200 handy Excel add-ins, free to try with no limitation in 60 days. Download and free trial Now!


Excel Productivity Tools

Ribbon of Excel (with Kutools for Excel installed)

300+ Advanced Features Increase Your Productivity by 70%, and Help You To Stand Out From Crowd!

Would you like to complete your daily work quickly and perfectly? Kutools For Excel brings 300+ cool and powerful advanced features (Combine workbooks, sum by color, split cell contents, convert date, and so on...) for 1500+ work scenarios, helps you solve 80% Excel problems.

  •  Deal with all complicated tasks in seconds, help to enhance your work ability, get success from the fierce competition, and never worry about being fired.
  •  Save a lot of work time, leave much time for you to love and care the family and enjoy a comfortable life now.
  •  Reduce thousands of keyboard and mouse clicks every day, relieve your tired eyes and hands, and give you a healthy body.
  •  Become an Excel expert in 3 minutes, and get admiring glance from your colleagues or friends.
  •  No longer need to remember any painful formulas and VBA codes, have a relaxing and pleasant mind, give you a thrill you've never had before.
  •  Spend only $39, but worth than $4000 training of others. Being used by 110,000 elites and 300+ well-known companies.
  •  60-day unlimited free trial. 60-day money back guarantee. Free upgrade and support for 2 years. Buy once, use forever.
  •  Change the way you work now, and give you a better life immediately!

Office Tab Brings Efficient And Handy Tabs to Office (include Excel), Just Like Chrome, Firefox, And New IE

  • Increases your productivity by 50% when viewing and editing multiple documents.
  • Reduce hundreds of mouse clicks for you every day, say goodbye to mouse hand.
  • Open and create documents in new tabs of same window, rather than in new windows.
  • Help you work faster and easily stand out from the crowd! One second to switch between dozens of open documents!
Say something here...
symbols left.
You are guest ( Sign Up? )
or post as a guest, but your post won't be published automatically.
Loading comment... The comment will be refreshed after 00:00.
  • To post as a guest, your comment is unpublished.
    Suyash · 7 months ago
    I have different worksheets in a workbook and I want to use VBA code for all worksheet at once .
    Can anybody help me out.


    For Example:
    In every sheet in A1 I have S.No. and I want it to be a Sequence number 1 2 3 4 .....
  • To post as a guest, your comment is unpublished.
    HARITHA A K · 11 months ago
    VERY THANKS
  • To post as a guest, your comment is unpublished.
    Kushal Arora · 1 years ago
    I have been manually adding serial numbers to sheets containing hundreds, if not thousands, of rows since the past few years. The above formula has literally save a whole lot of hours for me, for the rest of my life. Thank you, Op.
  • To post as a guest, your comment is unpublished.
    Riya · 1 years ago
    This is not working. Instead of filling series, it's just copying first cell.
  • To post as a guest, your comment is unpublished.
    Matt · 1 years ago
    All of these steps above are way too complicated when I just want to double click the Fill Handle and Fill Down over hidden rows. Could Kutools give us a way to AutoFill using the Fill handle over filtered/hidden rows just using double click?
    • To post as a guest, your comment is unpublished.
      skyyang · 1 years ago
      Hello, Matt,
      Thank you for your comment, Kutools does not support this feature so far, but, we will consider your suggestion.
      Thank you!