The best I can do is a custom function.
It's code, but it's very simple to use.
Once it's installed you use it like a lot of functions you are used to, such as Sum, Count etc.
The function is called CountCustom and in the example below you see that you type
=CountCustom( enter the cells) and press enter.
To install the code do the following.
Instructions for Installing Function Code
1) Make sure your worksheet is saved as .xlsm file (2007 and later versions).
2) Enable macros
3) Copy the code below, select the spreadsheet window and press Alt + F11, this will take you into the code editor.
4) Choose - Insert then Module from the menus along the top.
5) Paste the code where the cursor is flashing.
6) Close the window.
7) The function is now ready to be used.
8) In the cell you want to see the function results type
=CountCustom(select or type the cell reference you want in the function) hit enter.
Code:
Function CountCustom(Cells As Range) As Long
Dim tempArray, c As Long, r As Range
For Each r In Cells
If r.Value = Empty Then GoTo 1
If IsNumeric(r.Value) Then
c = c + 1
GoTo 1
End If
If InStr(1, r.Value, " ") Then
tempArray = Split(r.Value, " ")
If IsNumeric(tempArray(0)) And Trim(tempArray(1)) <> "TR" Then c = c + 1
End If
1 Next r
CountCustom = c
End Function
You say you want to count the cells with times in them, but not those with TR, which I believe in the case below is 13, so you see the function working.
Excel 2010
| A | B | C |
---|
| | | |
| | | |
| | | |
| | | |
11 L | | | |
11 TR | | | |
| | | |
| | | |
12 L | | | |
12 TR | | | |
OC | | | |
X | | | |
| | | |
| | | |
5 BS | | | |
5 TR | | | |
| | | |
6 BR | | | |
6 FR | | | |
6 TR | | | |
| | | |
OC BR | | | |
OC BS | | | |
OC FR | | | |
X | | | |
<tbody>
[TD="align: center"]1[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"]13[/TD]
[TD="align: center"]2[/TD]
[TD="align: right"]9[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: center"]3[/TD]
[TD="align: right"]10[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: center"]4[/TD]
[TD="align: right"]11[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: center"]5[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: center"]6[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: center"]7[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: center"]8[/TD]
[TD="align: right"]12[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: center"]9[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: center"]10[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: center"]11[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: center"]12[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: center"]13[/TD]
[TD="align: right"]4[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: center"]14[/TD]
[TD="align: right"]5[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: center"]15[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: center"]16[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: center"]17[/TD]
[TD="align: right"]6[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: center"]18[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: center"]19[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: center"]20[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: center"]21[/TD]
[TD="align: right"]7[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: center"]22[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: center"]23[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: center"]24[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: center"]25[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
</tbody>
Sheet1
[TABLE="width: 85%"]
<tbody>[TR]
[TD]
Worksheet Formulas[TABLE="width: 100%"]
<tbody>[TR="bgcolor: #DAE7F5"]
[TH]Cell[/TH]
[TH="align: left"]Formula[/TH]
[/TR]
[TR]
[TH="bgcolor: #DAE7F5"]C1[/TH]
[TD="align: left"]=CountCustom(
A1:A25)[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
</tbody>[/TABLE]