MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Finding out number of occurrences of string in one column?


Posted by Gary Hewitt-Long on December 22, 2001 12:56 PM

Hi,

Is there an easy way of finding out the number of times a string or the same value appears in say column B?

Regards,

Gary Hewitt-Long


Posted by Gary Hewitt-Long on December 22, 2001 12:58 PM

PS.

I nearly forgot to mention, the count figure will be used with an IF statement in a procedure to decide what to do next, so the result will be assigned to a variable.

Posted by Gary Hewitt-Long on December 22, 2001 2:24 PM

PS.

I nearly forgot to mention, the count figure will be used with an IF statement in a procedure to decide what to do next, so the result will be assigned to a variable.

Posted by Jacob on December 22, 2001 2:46 PM

Hi

Countif will do what you want.

=countif(range,criteria)

Jacob

Posted by Gary Hewitt-Long on December 23, 2001 1:06 AM

Thanks :o)

I forgot to mention I would rather not have to use a worksheet function, at the moment I insert a row enter the formula into A1 then use that (I have to insert a row because any row could be deleted depending on the result), but with a lot of linked data in the sheet this slows down the procedure considerably. I was hoping somehow I could use Count and to get it counted using VBA?

Regards,

Gary Hewitt-Long

Posted by Jacob on December 23, 2001 1:52 PM

try this application.worksheetfunction.countif()