LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,872
Default Need to flag the lead ID of any contiguous ID's from a sorted list of ID's.

Hi J.P.,

Am Wed, 8 Oct 2014 12:22:50 -0700 (PDT) schrieb JeanPierre Charron:

For instance :
ID Flag Comment
111 x is a lead
112
113
115 X Complex Case involving a similar numeric & alphanumeric
115A
123 x is isolated
250A x is a lead
250B
300A1 X is a lead
300A2


If there are no other "special" cases try:

Sub SetFlag()
Dim LRow As Long
Dim rngC As Range

With ActiveSheet
LRow = .Cells(Rows.Count, 1).End(xlUp).Row
Range("B2") = "x"

For Each rngC In .Range("A3:A" & LRow)
If Len(rngC) = 5 And Right(rngC, 1) = "1" Then
rngC.Offset(, 1) = "x"
ElseIf Right(rngC, 1) = "A" And Int(Left(rngC, 3)) _
< rngC.Offset(-1, 0) Then
rngC.Offset(, 1) = "x"
ElseIf Len(rngC.Offset(1, 0)) = Len(rngC) + 1 _
And InStr(rngC.Offset(1, 0), rngC) Then
rngC.Offset(, 1) = "x"
ElseIf IsNumeric(rngC) And Not _
IsNumeric(rngC.Offset(-1, 0)) Then
rngC.Offset(, 1) = "x"
End If
Next
End With

End Sub



Regards
Claus B.
--
Vista Ultimate / Windows7
Office 2007 Ultimate / 2010 Professional
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
XY scatter, select item in list to flag point Christine Charts and Charting in Excel 3 August 7th 08 09:20 AM
lookup in non sorted list Ron Excel Worksheet Functions 2 February 15th 08 01:28 PM
Using VLOOKUP without a sorted list dzuy Excel Programming 2 July 25th 06 04:28 PM
Sorted list G Chartrand Excel Discussion (Misc queries) 2 April 28th 06 05:07 PM
Need sorted validation list [email protected] Excel Worksheet Functions 0 September 23rd 05 06:15 PM


All times are GMT +1. The time now is 11:57 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"