Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Count of text in cells

I have problem to solve,I have a column with office. The text in the Office cells with be, Office 1@810@NT but I now have a new columm with text in the following format:Test The Cell - Employment cells can contain mutiple values, Test The Cell - Education;Test The Cell - Employment;Test The Cell - Health
. These values are separated by a ;
NOt only do I need to count each occurance, but I then need to have a count of each one. I can have these values referred to in a cell if that makes it easier. Sorry if I have not been clear


Submitted via EggHeadCafe - Software Developer Portal of Choice
The SQLite Database Engine and ADO.NET Provider
http://www.eggheadcafe.com/tutorials...ase-engin.aspx
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Count of text in cells


This should work where abc is you search string and A1:A100 is your
column

=SUMPRODUCT(--(ISERROR(FIND("abc",A1:A100))=FALSE))


Find will return an error if the string is not found. You want to count
the number of occurances that are NOT Errors


--
joel
------------------------------------------------------------------------
joel's Profile: 229
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=170383

Microsoft Office Help

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Count of text in cells

Hi Joel, thanks for your response,

The only problem with this, is that a cell can contain "abc" and other text within the cell. Example:

Cell A1, can contain the following, abc;somthingelse;abc;again somthing else;abc

The formula you supplied will only count "abc" once in this cell. The result in the examble above you be 3.



joel wrote:

This should work where abc is you search string and A1:A100 is
15-Jan-10

This should work where abc is you search string and A1:A100 is your
column

=SUMPRODUCT(--(ISERROR(FIND("abc",A1:A100))=FALSE))


Find will return an error if the string is not found. You want to count
the number of occurances that are NOT Errors


--
joel
------------------------------------------------------------------------
joel's Profile: 229
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=170383

Microsoft Office Help

Previous Posts In This Thread:


Submitted via EggHeadCafe - Software Developer Portal of Choice
ASP.NET Programmer's Reference [Wrox Press]
http://www.eggheadcafe.com/tutorials...mers-refe.aspx
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Count of text in cells


I went to Chip Pearson's webpage and found a solution using the
worksheetfunction REPLACE but it only worked on one cell.

'String Formulas' (http://www.cpearson.com/Excel/stringformulas.aspx)

=IF(LEN(B1)=0,0,(LEN(A1)-LEN(SUBSTITUTE(A1,B1,"")))/LEN(B1))

The function wouldn't work with a formula array. So it gave me the
idea to use a UDF function. Call thsi function like this


=CountString(A1:A100,"abc")

or

=CountString(A1:A100,bi)


Function CountString(Target, Pattern)

CountString = 0
For Each Cell In Target
MyString = Cell
Do While InStr(MyString, Pattern) 0
CountString = CountString + 1
MyString = Replace(expression:=MyString, _
Find:=Pattern, Replace:="", Start:=1, Count:=1)
Loop
Next Cell

End Function


The function keeps on replacing the search string with nothing until
the string isn't found any more counting the number of times the
replaement is done.


--
joel
------------------------------------------------------------------------
joel's Profile: 229
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=170383

Microsoft Office Help

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 blank cells and cells with text rk0909 Excel Discussion (Misc queries) 3 May 2nd 08 03:56 AM
Count single Text in cells with multiple text entries WSC Excel Discussion (Misc queries) 6 January 9th 07 04:17 PM
How do I count cells with text but ignore cells with spaces? Husker87 Excel Discussion (Misc queries) 2 September 21st 06 12:31 AM
count cells containing text Lisa W Excel Worksheet Functions 5 March 16th 06 12:48 AM
Count Cells containing Text only Soniya[_2_] Excel Programming 4 October 25th 03 04:32 PM


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