Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I couldn't find your file, but here's my offering:
Sub blah() rw = 5 'first row to check in column A LastRowToCheck = 35 'last row in column A to check (635 in your example) myTIMES = 0 Do StartRow = 0 EndRow = 0 Do 'establishes zzz row If Cells(rw, 1).Value = "zzz" Then StartRow = rw rw = rw + 1 Loop Until StartRow < 0 Or rw LastRowToCheck Do 'establishes next yyy row If Cells(rw, 1).Value = "yyy" Then EndRow = rw rw = rw + 1 Loop Until EndRow < 0 Or rw LastRowToCheck i = StartRow + 1 Do ' checks for 12v/12t sequence and counts them If Cells(i, 1) = "12v" And Cells(i + 1, 1) = "12t" Then myTIMES = myTIMES + 1 i = i + 1 Loop Until (i EndRow - 2 And EndRow < 0) Or i LastRowToCheck Loop Until rw 35 MsgBox "12t has immediately followed 12v " & myTIMES & " times after zzz and before yyy" End Sub -- p45cal "Carlo Gonella" wrote: Hi everyone. In the attachment you can see an easy example of what I need to have with the coding I can't actually figure out.. ( VIRUS FREE ). Hope someone can help ! Thanks in advance. --------------------------------------------------------------------------------------------------------------------------- Assuming I have a colum of codes Range("A:A") ... I know my codes are from A5 to A635. I also know there are some codes I can identify and which have relevant meaning in statistic analysis I have to do. I also know I need to analyze the codes between certain 'sequences'. i.e. : In the A5--A635 cells, I have 9 times the 'zzz' code. And in the same range, I have 8 times the 'yyy' code. I need to search this : How many times the code 12t comes exactly after the code 12v ( ie 12v in cell A7, 12t in cell A8 ) but ONLY when they are in a range delimited between 'zz'z and 'yyy' ? [snip] I hope it's clear and it's just something I miss... I can find anything I want to analyze... But not in multiple and non-contiguous ranges... Thank you for any hint. CarloG |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Searching into Non-Contiguous ranges in a columns | Excel Programming | |||
Non contiguous ranges | Excel Programming | |||
Copying non-contiguous columns to contiguous columns | Excel Programming | |||
summing non contiguous ranges | Excel Discussion (Misc queries) | |||
sorting non contiguous ranges | Excel Discussion (Misc queries) |