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 Count text then add results

I wish to add a row of cells that contain x or xx or xxx etc this I can
do with:-

=SUM(COUNTIF(C47:G47,"x")+COUNTIF(C47:G47,"xx")+CO UNTIF(C47:G47,"xxx")+COUNTIF(C47:G47,"xxxx")+COUNT IF(C47:G47,"xxxxx"))

The above gives me a count of the number of cells containing my criteria:-

However I wish to count the occurrences, contents of the cells: of how many
x in the range?


e.g.
c d e e f
x xx x xxx = 7

I am new to this nay help would be gratefully received!

  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 8,651
Default Count text then add results

If there is nothing but "x"s in the range, then
=SUM(LEN(C47:G47))
entered as an array formula (Control Shift Enter).

If there are other letters apart from the "x"s, then
=SUM(LEN(C47:G47))-SUM(LEN(SUBSTITUTE(C47:G47,"x","")))
again as an array formula.

Note that in your formula you didn't need SUM(), as you were adding the
COUNTIFs with the + operator, and it doesn't need SUM as well as +.
--
David Biddulph

"TonyH" wrote in message
...
I wish to add a row of cells that contain "x" or "xx" or "xxx" etc this I
can
do with:-

=SUM(COUNTIF(C47:G47,"x")+COUNTIF(C47:G47,"xx")+CO UNTIF(C47:G47,"xxx")+COUNTIF(C47:G47,"xxxx")+COUNT IF(C47:G47,"xxxxx"))

The above gives me a count of the number of "cells" containing my
criteria:-

However I wish to count the occurrences, contents of the cells: of how
many
"x" in the range?


e.g.
c d e e f
x xx x xxx = 7

I am new to this nay help would be gratefully received!



  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,501
Default Count text then add results

Tony,

Try this. Adjust the range to suit. Note this does both Upper and Lower case
X. If you want only one the delete the one you don't want from the formula

=SUMPRODUCT(LEN(A1:A20)-LEN(SUBSTITUTE(A1:A20,{"x","X"},"")))

Note this is an array and must ben entered by pressing CTRL+Shift+Enter NOT
just enter. If you do it correctly then Excel will put curly brackets around
the formula {}. You can't type these yourself.

Mike

"TonyH" wrote:

I wish to add a row of cells that contain x or xx or xxx etc this I can
do with:-

=SUM(COUNTIF(C47:G47,"x")+COUNTIF(C47:G47,"xx")+CO UNTIF(C47:G47,"xxx")+COUNTIF(C47:G47,"xxxx")+COUNT IF(C47:G47,"xxxxx"))

The above gives me a count of the number of cells containing my criteria:-

However I wish to count the occurrences, contents of the cells: of how many
x in the range?


e.g.
c d e e f
x xx x xxx = 7

I am new to this nay help would be gratefully received!

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2
Default Count text then add results


Thanks David ,

works OK the second time I tried, forget the Control Shift Enter first time!!
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 only visible results of formula Joe M. Excel Discussion (Misc queries) 3 September 4th 08 04:03 PM
need to compare dates and count results Heather[_2_] Excel Worksheet Functions 4 March 14th 07 01:15 AM
How can I count the results ??? Mark Allen Excel Worksheet Functions 4 November 23rd 06 03:59 PM
count occurence and present results Hobbes2006 Excel Worksheet Functions 2 August 7th 06 09:42 PM
how do I set the status bar to count results from filter? Attar Setting up and Configuration of Excel 1 April 20th 06 11:49 AM


All times are GMT +1. The time now is 02:48 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"