+ Reply to Thread
Results 1 to 4 of 4

Identify missing numbers

Hybrid View

  1. #1
    Registered User
    Join Date
    01-15-2008
    Posts
    16

    Question Identify missing numbers

    I need to be able to identify missing numbers that are in sequential order in column A. I would like to be able to run this so any missing number in column A will generate the missing number(s) in column B for my review.

    I have to run this weekly and the starting numbers will change that I start from.

    Ex. Week 1
    column A Column B
    455
    456
    457
    459 458
    461 460

    Week 2
    Column A Column B
    15
    16
    17 18,19,20
    21
    22
    25 23,24

    I am using Excel 07 and I have very little experience with Excel.


    Any help I can get is greatly appreciated.

  2. #2
    Forum Expert MickG's Avatar
    Join Date
    11-23-2007
    Location
    Banbury,Oxfordshire
    Posts
    2,650
    Hi, Try this.
    List in column "A", as yout post.
    Results in column "B" as required.
    Dim Nst As String, Fst As String, Diff As Integer, nu As Integer
    Dim cl As Range, AllNu As String
    
    For Each cl In Range(Range("A1"), _
        Range("A" & Rows.Count).End(xlUp))
       If IsNumeric(cl.Value) Then
         On Error Resume Next
        Fst = cl.Value
    
        Nst = cl.Offset(1, 0).Value
        
        If Val(Nst) > Val(Fst) Then
            If Not Val(Nst) = Val(Fst) + 1 Then
                Diff = Val(Nst) - Val(Fst)
        End If
             For nu = 1 To Diff - 1
                  Val (Fst) + nu
                    AllNu = AllNu & Val(Fst) + nu & ","
                Next nu
      cl.Offset(0, 1).Value = Left(AllNu, Len(AllNu) - 1)
           End If
        End If
    AllNu = ""
    Diff = 0
    Next cl
    Regards Mick

  3. #3
    Registered User
    Join Date
    01-15-2008
    Posts
    16
    I hate to ask but can you explain how to use/run this code.

    Thanks

  4. #4
    Registered User
    Join Date
    01-15-2008
    Posts
    16
    I got it to work. Thanks so much.

+ 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