Prev Previous Post   Next Post Next
  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5,651
Default about Matching

On Fri, 29 Aug 2008 19:36:00 -0700, Ting Li
wrote:

Hi everyone
I have got a column of data look like belows:
A
B
C
D
B
C
A
I want to find out the frequecy of certain consecutive patterns and generate
outputs like:
BC 2
BCD 1
BCA 1
ABCD 1

Which function(s) in Excel I can make us of ?


If your data is in A1:A7, and the pattern(s) you are looking for is in B1:Bn
you could use this formula:


=(SUM(LEN(MID(CONCATENATE($A$1,$A$2,$A$3,$A$4,$A$5 ,$A$6,$A$7),
ROW(INDIRECT("1:"&LEN(CONCATENATE($A$1,$A$2,$A$3,$ A$4,$A$5,$A$6,$A$7))
+1-LEN(B1))),LEN(B1))))-SUM(LEN(SUBSTITUTE(MID(CONCATENATE(
$A$1,$A$2,$A$3,$A$4,$A$5,$A$6,$A$7),ROW(INDIRECT(" 1:"&LEN(CONCATENATE(
$A$1,$A$2,$A$3,$A$4,$A$5,$A$6,$A$7))+1-LEN(B1))),LEN(B1)),B1,""))))/LEN(B1)

-------------------------

If your data is longer than 29 cells (pre-Excel 2003) or 255 cells (Excel
2007), then you can use the ampersand to construct the string.

If you fill down that formula, the reference to the pattern will change
appropriately.

-------------------------------------

If your data will be less than 256 characters, you could also download and
install Longre's free morefunc.xll add-in from
http://xcell05.free.fr/morefunc/english/index.htm

and use this simpler formula:

=REGEX.COUNT(MCONCAT($A$1:$A$7),B1)

Again, it assumes your data is in A1:A7, and the patterns are in B1:Bn.
--ron


 
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
Matching identical data using data only once in the matching proce Robert 1 Excel Discussion (Misc queries) 1 June 29th 07 04:22 PM
Help with Matching Text Fields - Then Moving the Matching Cells Side by Side [email protected] Excel Discussion (Misc queries) 2 June 11th 07 02:38 PM
matching John Excel Worksheet Functions 1 March 29th 07 12:40 PM
Matching data and linking it to the matching cell yvonne a via OfficeKB.com Links and Linking in Excel 0 July 13th 05 07:30 PM
Matching Eric Excel Worksheet Functions 2 May 3rd 05 02:53 PM


All times are GMT +1. The time now is 09:12 PM.

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

About Us

"It's about Microsoft Excel"