Counting consecutive text

paulontour

New Member
Joined
Jul 28, 2011
Messages
13
Hi

I have a column which has it in

Unclear
Suitable
Unclear
Unclear
Suitable
Suitable
Suitable etc etc

I would like the cell at the very end of the column (or begining) to say PASS when 3 consecutive suitables appear.

Is this possible?

Thanks
Paul.
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
Try this personalized function in Vba module:
Code:
Function COUNT_WORD(rng As Range, whichword As String, result As String)
For Each cll In rng
If cll = whichword And cll.Offset(1, 0) = whichword And _
cll.Offset(2, 0) = whichword Then
COUNT_WORD = result
Exit Function
End If
Next
End Function
The function ha 3 parameters:
rng = your range where find whichword (in your case is Suitable)
whichword = word to search
result = expected result
 
Upvote 0
Nowhere near as elegant

Private Sub Worksheet_Change(ByVal Target As Range)
Dim count As Integer
Dim c As Range, rng
If Target.Column = 1 Then
Range("b1").ClearContents
Set rng = Range("a1:a" & Target.Row)
For Each c In rng
If Target.Value = "Suitable" Then
count = count + 1
If count = 3 Then
Range("b1") = "Pass at row " & Target.Row
End If
Else
count = 0
End If
Next c
End If
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,514
Messages
6,179,219
Members
452,895
Latest member
BILLING GUY

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top