LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,872
Default Fast string comparison

Hi Robert,

Am Fri, 15 May 2015 05:35:23 -0700 schrieb Robert Crandal:

A B Value
--------- ------- -------
apple banana True
banana apple False
winner wins True
WiNneR winS True
right-handed left-handed False
apple apple False (equal)


try:
Function myComp(myRng As Range) As Boolean
Dim rngC As Range
Dim i As Long

For Each rngC In myRng
For i = 1 To Len(rngC)
If LCase(Mid(rngC, i, 1)) < _
LCase(Mid(rngC.Offset(, 1), i, 1)) Then
myComp = IIf(Asc(LCase(Mid(rngC, i, 1))) < _
Asc(LCase(Mid(rngC.Offset(, 1), i, 1))), True, False)
Exit For
End If
Next
Next
End Function

and call the function in the sheet with
=myComp(A1)

If nesessary you have to insert a Replace for hyphens and single quotes.


Regards
Claus B.
--
Vista Ultimate / Windows7
Office 2007 Ultimate / 2010 Professional
 
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
Fast way to truncate string Robert Crandal[_3_] Excel Programming 30 April 1st 15 11:43 PM
Fast string replacement Robert Crandal[_3_] Excel Programming 2 March 28th 15 02:59 AM
String Comparison [email protected] Excel Programming 5 July 7th 08 09:38 AM
how do I set up a fast comparison table? Biologist Excel Discussion (Misc queries) 1 June 21st 05 01:24 AM
Any fast method to parse a string into row & col information Nick Excel Programming 3 August 19th 04 06:47 PM


All times are GMT +1. The time now is 02:08 AM.

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"