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?
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.

GlennUK

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

Forum statistics

Threads
1,141,224
Messages
5,705,116
Members
421,378
Latest member
CarlosDuran

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
Top