Define 'is not working'
I entered some simple integers into A1:A20
To find how may 2's were in the range I use =freq(2,A1:A20) and it gave 8;
this agrees with a visual count and with =COUNTIF(A1:A20,2)
I then replaced some of my numbers with the word CAT
=freq("cat",A1:A20) and =COUNTIF(A1:A20,"cat") gave the same correct result.
Tell why you think your function is not working
best wishes
--
Bernard V Liengme
www.stfx.ca/people/bliengme
remove caps from email
"Sourav" wrote in message
oups.com...
Hi,
I am trying to write a function which takes a range and returns the
frequency of a data in it.
the function is :-
function freq ( q as variant , datarange as range)
count = 0
for i = 1 to datarange.rows.count
if datarange.cells(i,1). value = q then count= count+1
next i
freq = count
end function
this is not working, can any one suggest what is the prob. I just
learning VBA for excel .
is there any site where i can find tutorial for these, (I have
experience of C.) and a ebook to learn VBA for excel.
Thanks
Sourav