+ Reply to Thread
Results 1 to 3 of 3

Flag 1,3,5 and then every 5 after that?

  1. #1
    Registered User
    Join Date
    07-07-2004
    Posts
    2

    Flag 1,3,5 and then every 5 after that?

    I have data in a table that I need to flag with a X.
    The data I need flagged is for each unique value in column A I need the 1st, 3rd, 5th and then every 5 after that from column B until I reach a new unique number in column A.

    I have attached a sample of what I would like to see.
    I have 13000 of these so if I can I would like to have it automated somehow. I am at a loss for where to start.

    Any ideas?

    Please Login or Register  to view this content.
    Last edited by dcnc; 01-19-2007 at 02:59 PM.

  2. #2
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,967

    Response

    Try this

    Sub Test()
    For N = 1 To Cells(65536, 2).End(xlUp).Row
    If Cells(N, 1) <> "" Then
    Cells(N, 6) = "X"
    Else
    LastUniqueNumberRow = Cells(N, 1).End(xlUp).Row
    If N - LastUniqueNumberRow = 2 Or N - LastUniqueNumberRow = 4 Or (Int((N - LastUniqueNumberRow + 1) / 5) = ((N - LastUniqueNumberRow + 1) / 5)) Then
    Cells(N, 6) = "X"
    End If
    End If
    Next N
    End Sub


    I couldn't quite get the X's to match up with your example because in there appears to be some uneven gaps towards the bottom of the data set.
    Martin

  3. #3
    Registered User
    Join Date
    07-07-2004
    Posts
    2
    Thank you sir

+ 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