Excel formula to compare partial match cells -


i looking formula.

i need compare text in 2 cells (not columns).

one of cells has last name, other cell may have part of last name additional numbers , letters (not in specific order). these pairs locate.

not of cells match, ones part of text matches, "match".

for example in cell e2= 000034568mill walli , in cell j2=wallinger should bring match, since walli in cell e2 matches part of text.

another example:

e2= benjamin p rouamba , j2=roumbamoore should bring match.

i hope makes sense , there possible formula this.

there no built-in function in excel meets need. need customize own formula in vba project module. managed program function counts number of matches. adter setting module, can use normal formula in worksheet.

if not familiar vba programming, not worry. follow instructions , copy code below vba module.

press 'alt+f11' and, in menu, select insert > module

function countpartialmatch(r1 string, r2 string, m long) long      dim n long, l1 integer, l2 integer, min integer, c integer, s1 integer, s2 integer     n = 0     l1 = len(r1)     l2 = len(r2)     min = application.worksheetfunction.min(l1, l2)      c = m min         s1 = 1 (l1 - (c - 1))             s2 = 1 (l2 - (c - 1))                 if mid(r1, s1, c) = mid(r2, s2, c) n = n + 1                 next s2             next s1         next c      countpartialmatch = n  end function 

this formula requires 3 arguments:

=countpartialmatch(first_cell, second_cell, min_chrt) 

the argument min_chrt minimum number of characters match must have. if state 2, count matches 2 characters, 3 characters, 4, 5, 6... reduces number of coincidences. if 1, formula count every "a" = "a", letter = letter.

please, let me know if works fine you!


Comments

Popular posts from this blog

c# - Update a combobox from a presenter (MVP) -

How to understand 2 main() functions after using uftrace to profile the C++ program? -

How to put a lock and transaction on table using spring 4 or above using jdbcTemplate and annotations like @Transactional? -