PDA

View Full Version : How can I do this?



hexOffender
03-07-2007, 02:29 PM
I want to count all of the occurrences of the word "yes" and "no" in a column, each cell should either have yes, no or nothing.
Is ther a formula way to do this or vba ? the range is N2:N650

Bob Phillips
03-07-2007, 02:34 PM
=COUNTIF(N2:N650,"yes")

=COUNTIF(N2:N650,"no")

hexOffender
03-07-2007, 02:54 PM
thats what i needed thanks

Charlize
03-07-2007, 04:34 PM
Sub counts()
Dim yes As Long
Dim no As Long
yes = Application.WorksheetFunction.CountIf(Range("N2:N650"), "yes")
no = Application.WorksheetFunction.CountIf(Range("N2:N650"), "no")
MsgBox ("Occurances of yes : " & yes & vbCrLf & _
"Occurances of no : " & no)
End Sub