Count if Results

Brew

Well-known Member
Joined
Sep 29, 2003
Messages
1,569
How do I count the number of time the record result is greater than 20 in the list t4:t1003?
 

Some videos you may like

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
Joined
Jul 8, 2002
Messages
11,402
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
Joined
Sep 29, 2003
Messages
1,569
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
Joined
Jul 8, 2002
Messages
11,402
Please explain the difference between "a result" and "the numerical value of the formula", in precise terms.
 

Brew

Well-known Member
Joined
Sep 29, 2003
Messages
1,569

ADVERTISEMENT

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
Joined
Jul 8, 2002
Messages
11,402
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?
 

Brew

Well-known Member
Joined
Sep 29, 2003
Messages
1,569

ADVERTISEMENT

yes, exactly!
 

GlennUK

Well-known Member
Joined
Jul 8, 2002
Messages
11,402
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?
 

GlennUK

Well-known Member
Joined
Jul 8, 2002
Messages
11,402
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)
 

Watch MrExcel Video

Forum statistics

Threads
1,108,960
Messages
5,525,911
Members
409,671
Latest member
nasseralateek

This Week's Hot Topics

Top