+ Reply to Thread
Results 1 to 14 of 14

How to insert serial numbers for rows with gaps in between them

  1. #1
    Registered User
    Join Date
    10-12-2015
    Location
    Canada
    MS-Off Ver
    Excel 2013
    Posts
    95

    How to insert serial numbers for rows with gaps in between them

    Hi everyone. I am looking for a way to insert serial numbers in rows which have irregular gaps between them. For example, the 2nd row that contains information is located 3 rows after the first row, third row that contains information is located 5 rows after the second and so on.

    Regards

  2. #2
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: How to insert serial numbers for rows with gaps in between them

    Do you mean something like this:

    Data Range
    A
    B
    1
    Header
    2
    1
    Data
    3
    4
    5
    2
    Data
    6
    3
    Data
    7
    8
    9
    4
    Data
    10
    11
    5
    data
    12
    ------
    ------


    This formula entered in A2 and copied down:

    =IF(B2="","",COUNTA(B$2:B2))
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  3. #3
    Registered User
    Join Date
    10-12-2015
    Location
    Canada
    MS-Off Ver
    Excel 2013
    Posts
    95

    Re: How to insert serial numbers for rows with gaps in between them

    yes, that is what I meant, but somehow that formula does not appear to be working. I am sure I am making a mistake with it
    Last edited by terry3218; 10-12-2015 at 01:58 PM.

  4. #4
    Registered User
    Join Date
    10-12-2015
    Location
    Canada
    MS-Off Ver
    Excel 2013
    Posts
    95

    Re: How to insert serial numbers for rows with gaps in between them

    yes, that is what I meant, but somehow that formula does not appear to be working.Capture.PNG I am sure I am making a mistake with it

  5. #5
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,242

    Re: How to insert serial numbers for rows with gaps in between them

    Post a file rather than an image.

  6. #6
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: How to insert serial numbers for rows with gaps in between them

    Can't see *.png images.

    You might have to replace the commas with semi-colons:

    =IF(B2="";"";COUNTA(B$2:B2))

  7. #7
    Registered User
    Join Date
    10-12-2015
    Location
    Canada
    MS-Off Ver
    Excel 2013
    Posts
    95

    Re: How to insert serial numbers for rows with gaps in between them

    @Tony, I am afraid this formula is giving an error. I am trying but I cant insert an image here. Still thanks for your replies anyway.

  8. #8
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,242

    Re: How to insert serial numbers for rows with gaps in between them

    Try loading a sample file:

    Click "Go Advanced" then the Paper Clip Icon.

    "Click Add Files", then "Browse", select your file, "Upload" then Done"

  9. #9
    Registered User
    Join Date
    10-12-2015
    Location
    Canada
    MS-Off Ver
    Excel 2013
    Posts
    95

    Re: How to insert serial numbers for rows with gaps in between them

    Thanks a lot. I have done that. Now in this file I have manually inserted the serial no.s but I want a formula to do that.
    Attached Files Attached Files

  10. #10
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,242

    Re: How to insert serial numbers for rows with gaps in between them

    I inserted this into A2 (as per Tony's reply) and copied down and it produced the correct result

    =IF(B2="","",COUNTA(B$2:B2))
    Attached Files Attached Files

  11. #11
    Registered User
    Join Date
    10-12-2015
    Location
    Canada
    MS-Off Ver
    Excel 2013
    Posts
    95

    Re: How to insert serial numbers for rows with gaps in between them

    Quote Originally Posted by JohnTopley View Post
    I inserted this into A2 (as per Tony's reply) and copied down and it produced the correct result

    =IF(B2="","",COUNTA(B$2:B2))
    Thanks a billion.

  12. #12
    Registered User
    Join Date
    10-12-2015
    Location
    Canada
    MS-Off Ver
    Excel 2013
    Posts
    95

    Re: How to insert serial numbers for rows with gaps in between them

    Can you also share what is the significance of quotation marks(inside of quotation mark) here?

  13. #13
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,242

    Re: How to insert serial numbers for rows with gaps in between them

    B2="" checks if the cell is "empty" (null): if so A2 is set to null, otherwise it is set to the serial number calculated by the COUNTA function

    =IF(B2=null, null (true result), COUNTA(b$2:b2) (false result))

  14. #14
    Registered User
    Join Date
    10-12-2015
    Location
    Canada
    MS-Off Ver
    Excel 2013
    Posts
    95

    Re: How to insert serial numbers for rows with gaps in between them

    thanks a lot. I really appreciate.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Deleting rows but no changes in serial numbers of Data sheet
    By Tet Htut Naing in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-30-2015, 01:00 AM
  2. Formula to insert serial numbers automatically to an excel sheet with diff. items
    By saranorton in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 03-16-2015, 09:20 PM
  3. I want to delete rows that include some specific serial numbers
    By danieldaniel1 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-08-2014, 12:07 PM
  4. Replies: 0
    Last Post: 01-09-2013, 10:15 AM
  5. how to put serial numbers to data rows
    By sumesh56 in forum Excel General
    Replies: 3
    Last Post: 04-13-2012, 07:34 PM
  6. Finding gaps within rows of numbers
    By bd528 in forum Excel Programming / VBA / Macros
    Replies: 20
    Last Post: 01-24-2011, 12:35 PM
  7. [SOLVED] Renaming Sequential Rows to create serial numbers
    By forceten32 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 11-13-2005, 07:20 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1