+ Reply to Thread
Results 1 to 5 of 5

Find missing values in sequences, repeat for many ranges in a single sheet

  1. #1
    Registered User
    Join Date
    10-28-2012
    Location
    Traverse City, Michigan
    MS-Off Ver
    Excel 2007
    Posts
    2

    Find missing values in sequences, repeat for many ranges in a single sheet

    Hi all-

    Frequent visitor, macro-beginner, and first-time poster:)

    I have spreadsheets (example attached) with groups of data (indicated by "Image 1", "Image 2", etc. in column A) - each group is separated by a blank row. Each group needs to be represented by 61 rows of data, indicated by a continuous numeric sequence (from 1-61) in column B ("Time (min.)"). However, there are missing numbers in this sequence for most groups (e.g., the group "Image 1" is missing 1, 2, 4-12, 15-17 in column B, and so on). I would like a macro that can find these missing values in the sequences, insert a new row with the missing number entered into column B, and enter a value of "0" into column C (the remaining columns can be blank).

    I found a code (below) that can perform this on a sheet with only one group, however, I have not been able to modify this code to perform the task on each group moving down the spreadsheet (i.e, for many ranges that are not uniform). Note, the spreadsheet attached contains a simple example with 3 groups - I have many spreadsheets with approximately 50 groups each to process.

    Any help to create this macro would be appreciated!

    Thanks much!

    Please Login or Register  to view this content.
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591

    Re: Find missing values in sequences, repeat for many ranges in a single sheet

    Hi

    how about

    Note that this code only does the sort on column A:C. While you indicate that there may be other columns, you don't advise how many columns are really involved, or how the last column to be included in the sort may be determined, so this aspect will have to be expanded.


    Please Login or Register  to view this content.
    rylo
    Last edited by rylo; 10-28-2012 at 07:03 PM.

  3. #3
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: Find missing values in sequences, repeat for many ranges in a single sheet

    option, press Run button
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    10-28-2012
    Location
    Traverse City, Michigan
    MS-Off Ver
    Excel 2007
    Posts
    2

    Re: Find missing values in sequences, repeat for many ranges in a single sheet

    Thanks for your quick replies, rylo and watersev! Both work perfect for what I need - this will be a big timesaver.

    Thanks again!

  5. #5
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,926

    Re: Find missing values in sequences, repeat for many ranges in a single sheet

    If this answered your question, please take a moment to mark the thread as "solved" - it helps keep things neet and tidy lol, and consider adding the reputation to those that helped (see points 2 & 3 below)
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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