I've the following Excel data:
A B C
+ ------------ ------------- -----------------
1 | WORD WORD MIX MATCH TEXT RESULT
2 | somewordsome emsomordsowe ...
3 | anotherword somethingelse ...
4 | ... ... ...
I'd like to:
Firstly, get an array, say
ArrayOfGroups
, by splitting the string in theA2
cell in unique groups of 2 to 12 adjacent chars (note: 2 is the minimum number of chars to form a group; 12 is the total number of the word's chars) i.e. the groups of 2 chars would beso
,om
,me
,ew
,wo
,or
,rd
,ds
(note: the lastso
,om
andme
groups are excluded because they are repeated); the groups of 3 chars would besom
,ome
,mew
,ewo
,wor
,ord
,rds
,dso
(lastsom
andome
excluded); the groups of 4 chars would besome
,omew
,mewo
,ewor
,word
,ords
,rdso
,dsom
; ... and so on until the full stringsomewordsome
.Then, iterate the above-mentioned
ArrayOfGroups
to check if each of its element is a substring of theB2
cell and return a new array, sayArrayOfMatches
, containing all the elements (the characters "group names") that are substrings ofB2
and the number of occurrences found inB2
.Finally, output in the
C2
cell a sentence built using theArrayOfMatches
data that says something like this:2 matches for
so
, 1 match forsom
andrd
Probably there are other and better approaches to compute the above sentence that is the final result wanted. Maybe I need to use a User Defined Function... but I never made it.
Is there someone that could give help?