Advertisement

02.04.2008 at 02:36PM PST, ID: 23136574
[x]
Attachment Details

String comparison advice - vba

Asked by christamcc in Microsoft Excel Spreadsheet Software

Tags: Microsoft, Excel, 2003

I'm comparing two strings to see if they refer to the same movie title.  One string is the clean title and one is the title with lots of other info.  For example when compared they should return TRUE if actually the same movie.

SAME TITLE:
sCleanTitle = "2 Wrinkles: in Time #2"
sNotCleanTitle = "LLP 2 Wrinkles in Time (DVD)  - #2"  

SAME TITLE:
sCleanTitle = "YOUR MOTHER'S HOUSE"
SNotClean = "NSP - Your Mothers House - VHS -"

FYI- there is no pattern of how the sNotClean could be.  the Version Number might not be at the end.  it could be like this: sNotCleanTitle = "LLP 2 Wrinkles in Time #2 - (DVD)" .  sCleanTitle will always have the version number at the end if it HAS a version #.

So I think basically I to compare them I need to UCase them, Trim them, get rid of all the characters except the # and then InStr the title and the version number (including the #) if there is a version number.  Maybe?

sVersionNum = "#2"
sTitle = "2 WRINKLES IN TIME"  <--Got rid of all extra characters

If InStr(sNotCleanTitle, sVersionNum) > 0 and InStr(sNotCleanTitle, sTitle) Then
 bTheSame = TRUE
End If

I don't know regular expression well enough to pull out the info I need.  So I need a solution on how to pull out sTitle and sVersionNum for the sCleanTitle or any other suggestions of how to compare the strings!

thanks!
ChristaStart Free Trial
[+][-]02.04.2008 at 03:09PM PST, ID: 20819110

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Microsoft Excel Spreadsheet Software
Tags: Microsoft, Excel, 2003
Sign Up Now!
Solution Provided By: a_twixt_in_the_tale
Participating Experts: 2
Solution Grade: A
 
 
[+][-]02.04.2008 at 03:32PM PST, ID: 20819278

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]02.04.2008 at 04:10PM PST, ID: 20819512

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628