Countif with formulae

Tigerexcel

Active Member
Joined
Mar 6, 2020
Messages
493
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
With a range of cells how do you get COUNTIF to return the number of cells that contain formulae. I have tried Countif(a1:d5,isformula(a1:d5)) as well as a few other versions but no luck.
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
Thanks Tetra, can it be done with COUNTIF or is there a limitation with COUNTIF?
 
Upvote 0
You are welcome.

IMO, no, this cannot be done with COUNTIF because it compares cell value with the criterion.
 
Upvote 0
Thanks for the explanation, closest I can get is COUNT(IF(ISFORMULA(a1:D5),1,""))
 
Upvote 0
In case you are interested, here is a small UDF

VBA Code:
Function count_formulae(rg As Range)
    For Each c In rg.Cells
        If c.HasFormula Then count_formulae = count_formulae + 1
    Next c
End Function

Enter this formula

=count_formulae(A1:D5)
 
Upvote 0
one more option... Non VBA

(hit CTRL+SHIFT+ENTER) after typing the below formula:

=SUM(IF(ISFORMULA(A1:D5)=TRUE,1,0))
 
Upvote 0
Thanks Hrayani. This is what makes Excel my favourite program, the ability to solve a problem in different ways. Like the UDF when it's nice and simple.
 
Upvote 0
Thanks Hrayani. This is what makes Excel my favourite program, the ability to solve a problem in different ways. Like the UDF when it's nice and simple.

You are always welcome.... :)
 
Upvote 0

Forum statistics

Threads
1,214,391
Messages
6,119,244
Members
448,879
Latest member
VanGirl

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
Back
Top