# Count if Results

#### Brew

##### Well-known Member
How do I count the number of time the record result is greater than 20 in the list t4:t1003?

### Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop

#### GlennUK

##### Well-known Member
Don't know what you mean by "record result", but if you want to know how many cells in t4:t1003 have a value greater than 20 use:
Code:
``=COUNTIF(T4:T1003,">20")``

#### Brew

##### Well-known Member
This does not give the desired result, it should only count if formula in the cell range gives a result greater than 20, however it counts the numerical value of the formula as well (eg:=IF(T270="Y","x",IF((T270="N")*(T269="Y"),1,U269+1))

#### GlennUK

##### Well-known Member
Please explain the difference between "a result" and "the numerical value of the formula", in precise terms.

#### Brew

##### Well-known Member

I only had 2 cases in this range where formula gave a result of greater than 20, but the formula returned 20, meaning it counting the numbers in the formula in the cells, that a value greater than 20

#### GlennUK

##### Well-known Member
This doesn't make sense :
it counting the numbers in the formula in the cells, that a value greater than 20

Are you trying to say that it was counting entries in cells as well as formulae results?

yes, exactly!

#### GlennUK

##### Well-known Member
The COUNTIF function does not distinguish between cells that have values as entries and values that are the result of formulae. In fact I don't think any functions make that distinction. The whole point of Excel is that you can have formulae to create values that are treated the same as actual entries. I'd say you are going to have to create some VBA to do what you want ... how are your VBA skills?

#### Brew

##### Well-known Member
That makes sense. I would need help with VBA

#### GlennUK

##### Well-known Member
It'd be something like:
Code:
``````Function CountFormulaeGT(inputrange As Range, intGTcriteria As Integer) As Integer
Application.Volatile
CountFormulaeGT = 0
For Each c In inputrange
If Left(c.Formula, 1) = "=" Then
If c.Value > intGTcriteria Then
CountFormulaeGT = CountFormulaeGT + 1
End If
End If
Next
End Function``````
entered into a cell like this:
=countformulaegt(t4:t1003,20)

Replies
4
Views
90
Replies
3
Views
61
Replies
1
Views
73
Replies
1
Views
43
Replies
8
Views
92