Counting literals in cells

  • Thread starter Thread starter Joeyej
  • Start date Start date
J

Joeyej

I'm trying to figure a quick way using a macro to count the results of
a survey recorded in an Excel spreadsheet. Each record in the survey
has cells that may contain "Yes", "No", "Maybe", "Sometimes" and
"Occasionally". Is there a macro that can count occurrences of each
literal and report their totals?

Thanks,

Joeyej
 
Hi Joeyei,

In excel you can use the CountIf worksheet function:

=CountIf(A1:A100,"Yes")

If you need to do this in code:

Dim Var As Long

Var = Application.CountIf(Range("A1:A100"), "Yes")
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top