Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 112
Default Count one character in a string across a range of cells?

I have a column of cells containing strings of numbers and letters. I'm
trying to count the occurrence of individual numbers and letters. What
function should I use?
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,058
Default Count one character in a string across a range of cells?

If you have a column of items like and want to count the "a" character:

asdfd
aa
dfa
ffdq
faasf
ccv
aarwwe
a32
tg3q

then use:

=SUM(LEN(A1:A100)-LEN(SUBSTITUTE(A1:A100,"a",""))) to display 9

This is an array formula that must be entered with CNTRL-SHFT-ENTER rathr
than just the ENTER key
--
Gary''s Student - gsnu200832


"Andrea" wrote:

I have a column of cells containing strings of numbers and letters. I'm
trying to count the occurrence of individual numbers and letters. What
function should I use?

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,346
Default Count one character in a string across a range of cells?

Hi,

In 2007 you could use

=SUMPRODUCT(LEN(A:A)-LEN(SUBSTITUTE(A:A,"a",)))

or in all versions:

=SUMPRODUCT(LEN(A1:A10)-LEN(SUBSTITUTE(A1:A10,"a",)))

--
If this helps, please click the Yes button

Cheers,
Shane Devenshire


"Andrea" wrote:

I have a column of cells containing strings of numbers and letters. I'm
trying to count the occurrence of individual numbers and letters. What
function should I use?

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 5,934
Default Count one character in a string across a range of cells?

Just to point out... this formula is case sensitive... it will not count
upper case A's, only lower case ones. The standard method to do a case
insensitive count would be this...

=SUMPRODUCT(LEN(A1:A10)-LEN(SUBSTITUTE(LOWER(A1:A10),LOWER("a"),"")))

an alternative to this would be this...

=SUMPRODUCT(COUNTIF(A1:A10,"*"&REPT("a"&"*",ROW(1: 99))))

provided you know there are no more than a maximum of 99 A's or a's in any
one cell (if there could be more, just increase the 99 to that number or
more).

--
Rick (MVP - Excel)


"Shane Devenshire" wrote in
message ...
Hi,

In 2007 you could use

=SUMPRODUCT(LEN(A:A)-LEN(SUBSTITUTE(A:A,"a",)))

or in all versions:

=SUMPRODUCT(LEN(A1:A10)-LEN(SUBSTITUTE(A1:A10,"a",)))

--
If this helps, please click the Yes button

Cheers,
Shane Devenshire


"Andrea" wrote:

I have a column of cells containing strings of numbers and letters. I'm
trying to count the occurrence of individual numbers and letters. What
function should I use?


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
How do I count occurances of a specific character in a range? Viridel Excel Worksheet Functions 1 January 18th 08 01:55 AM
Excel-Match 1st text character in a string to a known character? bushlite Excel Worksheet Functions 2 January 15th 07 06:36 PM
Get first character in cell and count all cells that begin with 1,2,3 etc [email protected] Excel Discussion (Misc queries) 5 June 8th 06 05:04 PM
Character Count Range of Cells michimac Excel Discussion (Misc queries) 1 May 29th 05 11:26 PM
Character Count Range of Cells Naz Excel Discussion (Misc queries) 0 May 29th 05 10:28 PM


All times are GMT +1. The time now is 02:54 AM.

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"