Thread: match problem
View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.worksheet.functions
bill gras
 
Posts: n/a
Default match problem

Hi Bob and Harlan

Thank you both for your reply's
--
bill gras


"Harlan Grove" wrote:

bill gras wrote...
Hi Bob
=LEN(B2) returned " 13 "
=LEN(R1!N39) returned " 14 "
Can you tell me how and if I need to use the " TRIM " function.

....

If your two strings are of different length, then they're necessarily
not equal. If there's no visual difference between them, then the most
likely difference is different numbers of space characters at the
beginning or end of one of the strings. However, there are two types of
space characters: breaking (ASCII) and [html] nonbreaking. Excel's TRIM
function only removes the former. Check this with

=TRIM(B2)=TRIM(R1!N39)

and

=COUNTIF(R1!N39,"*"&B2&"*")=1

If the former returns FALSE but the latter returns TRUE, then it's
almost certain R1!N39 contains a leading or trailing nonbreaking space.
In which case, try

=TRIM(B2)=TRIM(SUBSTITUTE(R1!N39,CHAR(160)," "))

If that returns TRUE, you'll find it easiest to remove the nonbreaking
spaces from the range in the R1 worksheet. However, it it returns
FALSE, then there's some nastier difference between the two cells and
you're going to need to compare them character by character. If cells
X99:Z99 were blank, enter the following.

X99:
1

Y99:
=CODE(MID(B2,X99,1))

Z99:
=CODE(MID(R1!N39,X99,1))

Manually increment X99 until Y99 and Z99 show different values. X99
would give the position of first (leftmost) character that differs
between the two.