Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Counting instances of a certain number in Excel

Status
Not open for further replies.

saadabc

Programmer
Aug 5, 2004
107
US
Is there a script that lets you count the instances of a certain number on a given row in Excel. The script can be in any language - C, C++, VB, VBScript etc ...


 
Excel has the function built in. Have a look at COUNTIF.

Example:
=countif(2:2,a1)

To get VBA code, just turn on macro recorder.

[tt]_____
[blue]-John[/blue]
[/tt][red]"I'm against picketing, but I don't know how to show it."[/red]
-Mitch Hedberg

Help us help you. Please read FAQ181-2886 before posting.
 
I'm using =COUNTIF(A14:BH14,"*") to count number of asterisks in the 14th row - =COUNTIF(A15:BH15,"*") for number of asterisks in 15th row - but it is giving me the wrong number. Example, the number of asterisks in the 14th row is 10, but it is giving me 59 , number of asterisks in the 15th row is 9, but is giving me 59. It is giving me 59 for all rows. Data is the sheet may look like this - 5<6* , 9=5* .. i want to count the number of cells that have data that contains an asterisk.

what am i doing wrong in the formula..

 
See your other post for a solution

----------------------------------------------------------------------------
[peace]It's easier to beg forgiveness than ask permission[2thumbsup]
----------------------------------------------------------------------------
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top