Find position of first non-matching character
On Fri, 30 May 2008 09:35:58 -0700 (PDT), Greg Lovern wrote:
I have two strings that start with the same characters, but at some
unknown and varying point they begin to differ. I want the position
number of the first non-matching character.
For example:
-- table and chair
-- table plus chair
-- position of first non-matching character is 7 (the "a" in
"and", and the "p" in "plus").
In the above example, both strings start out "table ", then start to
differ beginning with the 7th character. How can I return the position
of the first non-matching character, which in this example is 7?
Thanks,
Greg
You could use this **array** function.
Make sure the "99" is greater than the length of your longest string.
=MATCH(FALSE,MID(A1,ROW($1:$99),1)=MID(A2,ROW($1:$ 99),1),0)
To enter an **array** function, hold down <ctrl<shift while hitting <enter.
Excel will place braces {...} around the formula.
--ron
|