EXCEL count string within matrix ??

  cga 13:05 17 Aug 04
Locked

I don't know if anyone can help me with this?

I have a number of sheets, each of which has 64 rows and 16 columns. The cells contain 6 character text values (actually they are volume labels).

What I would like to do is count the number of cells where the text value starts with a specific 3 characters.

Can anyone help me with a macro for this please?

Thanks in advance

  VoG II 13:19 17 Aug 04

You will need to run this on each sheet in turn.

Sub test2()

Dim iCol As Integer, iRow As Integer, findme As String, kount

kount = 0

findme = "aaa"

For iCol = 1 To 16

For iRow = 1 To 64

If Left(Cells(iRow, iCol).Value, 3) = findme Then kount = kount + 1

Next iRow

Next iCol

MsgBox ("Found " & kount & " instances")

End Sub

  cga 13:25 17 Aug 04

Brilliant - I will give that a go but it looks fine. Thanks

  cga 13:57 17 Aug 04

Works well & saved me a lot of time - Thanks.

This forum is the tops.

This thread is now locked and can not be replied to.

Best phone camera 2016/2017: Galaxy S7 vs iPhone 7 vs Google Pixel vs HTC 10 Evo vs OnePlus 3T vs…

1995-2015: How technology has changed the world in 20 years

These are the Best Christmas Ads and Studio Projects of 2016

Super Mario Run preview | Hands-on first impressions of Super Mario Run: Mario's iPhone & iPad…