Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2
Default How do I count occurances of a specific character in a range?

I collect stats for a sports team, and the sheet used tracks Goals (G),
Assists (A) and Shots (I) all in the same cell, with one cell per period.
What I need to be able to do is track the number of times a "G" comes up in a
period for a team, as well as over all the periods of the game for the
specific player. COUNT seems to be all-or-none for the entire cell (match or
doesn't match), while FIND/SEARCH only returns the first incidence of the
character (so if two goals are scored by the same player in the same period,
only the first gets recorded)

So, If I were to use the following data list, what could I put at "the
bottom" in order to give a Goals Total for that period?

AA
GGI
G
IG
A
A

Please & Thanx!
- Jason
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 35,218
Default How do I count occurances of a specific character in a range?

To count the number of G's in a single cell:
=len(a1)-len(substitute(a1,"G",""))

to count the number of G's or g's (upper or lower) in a single cell:
=len(a1)-len(substitute(upper(a1),"G",""))

To count the number of G's in a contiguous range:
=sumproduct(len(a1:a10)-len(substitute(a1:a10,"G","")))

To count the number of G's or g's in a contigous range:
=sumproduct(len(a1:a10)-len(substitute(upper(a1:a10),"G","")))




Viridel wrote:

I collect stats for a sports team, and the sheet used tracks Goals (G),
Assists (A) and Shots (I) all in the same cell, with one cell per period.
What I need to be able to do is track the number of times a "G" comes up in a
period for a team, as well as over all the periods of the game for the
specific player. COUNT seems to be all-or-none for the entire cell (match or
doesn't match), while FIND/SEARCH only returns the first incidence of the
character (so if two goals are scored by the same player in the same period,
only the first gets recorded)

So, If I were to use the following data list, what could I put at "the
bottom" in order to give a Goals Total for that period?

AA
GGI
G
IG
A
A

Please & Thanx!
- Jason


--

Dave Peterson
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Count occurances within a date range Marc Excel Discussion (Misc queries) 6 March 6th 07 04:29 PM
count number of occurances of a word in a range John Davies Excel Worksheet Functions 3 February 24th 06 01:46 PM
Count occurances in range of cells Ed Gregory Excel Worksheet Functions 1 September 7th 05 04:12 PM
count date occurances in range of dates... Alex Excel Worksheet Functions 2 July 27th 05 04:15 PM
Count the occurances of a month in a range of date fields Keith Brown Excel Worksheet Functions 8 March 14th 05 11:24 AM


All times are GMT +1. The time now is 03:43 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"