Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Junior Member
 
Posts: 1
Default Count multiple specific terms

Hi,

I am looking to run a count (or similar) function to find cells that contain two words that are not immediately following.

E.g.
Cell B2: "this cell contains text"
Cell B3: "this cell contains no text"
Cell B4: "this table contains no text"

Count (how many times "no" and "cell" appear in the same cell). =1

Can anybody advise such a function?
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,872
Default Count multiple specific terms

Hi,

Am Wed, 11 Jun 2014 13:28:31 +0100 schrieb masking:

Cell B2: "this cell contains text"
Cell B3: "this cell contains no text"
Cell B4: "this table contains no text"


try following UDF:

Function myWords(myRng As Range, ParamArray searchW()) As Long
Dim rngC As Range
Dim i As Long, counter As Long

For Each rngC In myRng
counter = 0
For i = LBound(searchW) To UBound(searchW)
If InStr(rngC, searchW(i)) Then
counter = counter + 1
End If
Next
If counter = UBound(searchW) + 1 Then
myWords = myWords + 1
End If
Next
End Function

and call the function into the sheet with:
=myWords(B1:B100,"cell","no")


Regards
Claus B.
--
Vista Ultimate / Windows7
Office 2007 Ultimate / 2010 Professional
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
Instr() with multiple search terms ExcelMonkey Excel Programming 4 September 23rd 09 11:08 AM
Count across multiple columns, using specific criteria MMcQ Excel Discussion (Misc queries) 9 August 27th 09 05:43 AM
How can I count specific words found across multiple spreadsheets. dutton.dn Excel Worksheet Functions 3 January 3rd 08 06:49 AM
Vlookup multiple terms and return one value sahafi Excel Worksheet Functions 5 June 21st 06 09:11 PM
Count Specific word in Specific range [email protected] Excel Programming 1 May 16th 06 10:55 AM


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