Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 239
Default How to find difference in cell contents visibaly looking same

I have two cells in different sheets which looks like contents are
same.
But excel thinks that the contents are different coz it giving error
in vlookup, arrey, if formulas.

I have tried to trim the same but of no use.
If I type the content ALPHAGEO, then i get the results but otherwise
only errors.
I tried to press F2 and see the contents if there is leading or
trailing spaces but no.
I tried to compare the same with the IF function, it is says both are
different and IF formula result is false.

Is there is a way to find out what is the difference by any formula or
VBA?

Regards,
Madiya
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default How to find difference in cell contents visibaly looking same

Use this code below to help find differences. You may have a problem with
capitalization where one character is a small letter and the other a capital
letter. Use UCASE() on bot characters strings to make them the same.

Sub teststring()

comparestr = "124"
If Len(comparestr) < Len(Range("B2").Text) Then
MsgBox ("String Length are different : " & _
Len(comparestr) & "/" & Len(Range("B2")))
Else
For i = 1 To Len(comparestr)
If Mid(comparestr, i, 1) < Mid(Range("B2"), i, 1) Then
MsgBox ("Char " & i & " is different : " & _
Mid(comparestr, i, 1) & "/" & Mid(Range("B2"), i, 1))
End If
Next i
End If

End Sub


"Madiya" wrote:

I have two cells in different sheets which looks like contents are
same.
But excel thinks that the contents are different coz it giving error
in vlookup, arrey, if formulas.

I have tried to trim the same but of no use.
If I type the content ALPHAGEO, then i get the results but otherwise
only errors.
I tried to press F2 and see the contents if there is leading or
trailing spaces but no.
I tried to compare the same with the IF function, it is says both are
different and IF formula result is false.

Is there is a way to find out what is the difference by any formula or
VBA?

Regards,
Madiya

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,651
Default How to find difference in cell contents visibaly looking same

On Fri, 10 Oct 2008 21:48:11 -0700 (PDT), Madiya wrote:

I have two cells in different sheets which looks like contents are
same.
But excel thinks that the contents are different coz it giving error
in vlookup, arrey, if formulas.

I have tried to trim the same but of no use.
If I type the content ALPHAGEO, then i get the results but otherwise
only errors.
I tried to press F2 and see the contents if there is leading or
trailing spaces but no.
I tried to compare the same with the IF function, it is says both are
different and IF formula result is false.

Is there is a way to find out what is the difference by any formula or
VBA?

Regards,
Madiya


A formula type approach.

First of all, the most common issue is that one of the cells has the <nbsp
character having been imported from a web or html document. The ASCII code is
0160 and that can be used to replace it. E.g. use char(160) in the substitute
function.

To split out the individual components, with your test string in A1,

B1: =CODE(MID($A$1,COLUMNS($A:A),1))

and fill right until you get #VALUE errors.

--ron
Reply
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
Find difference between 2 cells if critera in a 3rd cell is met Eric E Excel Discussion (Misc queries) 3 February 25th 10 08:19 PM
VBA to find difference in cell locations James Excel Discussion (Misc queries) 2 December 31st 09 04:00 PM
Find contents of the last cell in a row OCONUS Excel Worksheet Functions 4 September 18th 06 09:37 PM
Try to find the difference by percentage between 2 cell totals chedd via OfficeKB.com New Users to Excel 1 June 8th 06 09:40 AM
Find Contents of Cell (Macro) - Help me! MrMerton[_6_] Excel Programming 7 October 27th 05 03:55 PM


All times are GMT +1. The time now is 08:56 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"