Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 186
Default Using COUNTIF

I have a range of number between 1 and 5. Four of the cells in the range
display formulas. The formulas I am using to determine the number of 1's,
2's, 3's, etc a COUNTIF(A1:A233,"1");..... COUNTIF(A1:A233,"5"). How do
I get the COUNTIF formulas to count the cells containing the formulas?
  #2   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 3,718
Default Using COUNTIF

=SUMPRODUCT(--(A1:A233=1),--(A1:A233<=5))
or
=SUM(COUNTIF(A1:A233,{1,2,3,4,5}))

"Jack" wrote:

I have a range of number between 1 and 5. Four of the cells in the range
display formulas. The formulas I am using to determine the number of 1's,
2's, 3's, etc a COUNTIF(A1:A233,"1");..... COUNTIF(A1:A233,"5"). How do
I get the COUNTIF formulas to count the cells containing the formulas?

  #3   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 10,593
Default Using COUNTIF

You need a UDF to return an array of TRUE/FALSE for formulae

Function IsFormula(rng As Range)
Dim cell As Range, row As Range
Dim i As Long, j As Long
Dim aryFormulae As Variant

If rng.Areas.Count 1 Then
IsFormula = CVErr(xlErrValue)
Exit Function
End If

If rng.Cells.Count = 1 Then

ReDim aryFormulae(1 To 1)
aryFormulae(1) = rng.HasFormula
Else

aryFormulae = rng.Value
i = 0

For Each row In rng.Rows
i = i + 1
j = 0

For Each cell In row.Cells
j = j + 1
aryFormulae(i, j) = cell.HasFormula
Next cell
Next row
End If

IsFormula = aryFormulae
End Function

and then count them like so

=SUMPRODUCT(--(IsFormula(A1:A10)))

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Jack" wrote in message
...
I have a range of number between 1 and 5. Four of the cells in the range
display formulas. The formulas I am using to determine the number of 1's,
2's, 3's, etc a COUNTIF(A1:A233,"1");..... COUNTIF(A1:A233,"5"). How
do
I get the COUNTIF formulas to count the cells containing the formulas?



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I use a countif function according to two other countif fu. Kirsty Excel Worksheet Functions 2 February 20th 06 11:44 AM
edit this =COUNTIF(A1:F16,"*1-2*")+COUNTIF(A1:F16,"*2-1*") sctroy Excel Discussion (Misc queries) 2 September 25th 05 04:13 AM
COUNTIF or not to COUNTIF on a range in another sheet Ellie Excel Worksheet Functions 4 September 15th 05 10:06 PM
countif? anand Excel Worksheet Functions 1 May 12th 05 07:56 PM
COUNTIF in one colum then COUNTIF in another...??? JonnieP Excel Worksheet Functions 3 February 22nd 05 02:55 PM


All times are GMT +1. The time now is 11:12 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"