Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Ignore punctuation
Hi,
Is there a way to ignore all punctuation and special characters when comparing two string expressions? |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Ignore punctuation
I can't think of anything that does that. The worksheet function clean can
remove non-printing characters. I think you would need to write a UDF to do it. -- Regards, Tom Ogilvy "Purnima" wrote in message ... Hi, Is there a way to ignore all punctuation and special characters when comparing two string expressions? |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Ignore punctuation
first strip the strings of "unwanted" characers.. before you compare.. Option Compare Binary Function StripString(s$) 'Note: LIKE depends on option compare.see VBA help. Dim i&, r$, c$ Const mask = "[A-Za-z0-9]" For i = 1 To Len(s) c = Mid$(s, i, 1) If c Like mask Then r = r & c Next StripString = r End Function then compare like.. If StrComp(StripString(MyString1), _ StripString(myString2)) = 0 Then MsgBox "stripped compare OK" ElseIf StrComp(StripString(MyString1), _ StripString(myString2), vbTextCompare) = 0 Then MsgBox "stripped compare CaseInsensitive OK" Else MsgBox "NOT" End If -- keepITcool | www.XLsupport.com | keepITcool chello nl | amsterdam Purnima wrote : Hi, Is there a way to ignore all punctuation and special characters when comparing two string expressions? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Ignoring punctuation when sorting | Excel Discussion (Misc queries) | |||
remove punctuation from address | New Users to Excel | |||
Punctuation English/Danish | Setting up and Configuration of Excel | |||
Remove Punctuation? | Excel Worksheet Functions | |||
How to I change punctuation spacing | Excel Discussion (Misc queries) |