Results 1 to 6 of 6
  1. #1
    New Lounger
    Join Date
    Apr 2001
    Location
    Dallas, Texas, USA
    Posts
    24
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Comparing Text (Off 97/XP Pro SP1)

    I just can't seem to get the right formula combination. Perhaps someone can point me the right way. I can email small extracts of my spreadsheets if it would help.
    Here's what I'm trying to do:

    1. Compare cell-text in ColumnA /Sheet1 to cell-text in ColumnA/Sheet2.

    2. I want <= results because the character strings in Sheet2 often times contain more
    characters. So, ZOOM, in Sheet1 should compare to ZOOM-OLD in Sheet2. And, ZOOM can equal ZOOM.

    3. When the test is TRUE I want to put a constant character in an adjacent cell in
    another column; when it's FALSE, I want a different constant.

    4. Sheet1 has around 600+ rows and Sheet2 has 400+, so the cell comparisons are in different locations between Sheets. That's my problem.

    I tried MATCH but it's Equal, Less Than, Greater Than characteristics don't always test correctly with my data. I think I need something like CONTAINS.

    Any suggestions are appreciated.

  2. #2
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Salt Lake City, Utah, USA
    Posts
    9,508
    Thanks
    0
    Thanked 6 Times in 6 Posts

    Re: Comparing Text (Off 97/XP Pro SP1)

    Nick, after re-reading your question I'm certain that my original answer was wrong so I deleted it and I'm posting an attached spreadsheet which I hope will be useful.
    Attached Files Attached Files
    -John ... I float in liquid gardens
    UTC -7ąDS

  3. #3
    Uranium Lounger
    Join Date
    Jan 2001
    Location
    South Carolina, USA
    Posts
    7,295
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Comparing Text (Off 97/XP Pro SP1)

    Here is a User Defined VBA Function which I think will do what you want:

    <pre>Public Function MatchStr(strToFind As String, oTable As Range) As Boolean
    Dim oCell As Range
    MatchStr = False
    If strToFind = "" Then Exit Function
    For Each oCell In oTable
    If InStr(oCell.Value, strToFind) > 0 Then
    MatchStr = True
    Exit Function
    End If
    Next oCell
    End Function
    </pre>


    You would use this function with a formula like this:

    <pre>=IF(matchstr(A1,Sheet2!$A$1:$A$400),"Yes","No ")
    </pre>

    Legare Coleman

  4. #4
    New Lounger
    Join Date
    Apr 2001
    Location
    Dallas, Texas, USA
    Posts
    24
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Comparing Text (Off 97/XP Pro SP1)

    Thanks John. I'll try it. Here is a small extract of my Workbook. Comparing ColumnA in both Sheets. Looking for a <= result; if True, then put Y in Column E of Sheet1 in the respective cell.
    Attached Files Attached Files

  5. #5
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Salt Lake City, Utah, USA
    Posts
    9,508
    Thanks
    0
    Thanked 6 Times in 6 Posts

    Re: Comparing Text (Off 97/XP Pro SP1)

    In Cell E2 array enter (Ctrl-Shift-Enter)

    =IF(COUNT(FIND(TSM!$A$1:$A$37,A2)),"Y","N")

    Array-entering will place the curly parens {} around the formula. Copy it down. It will find ARGO, etc.
    -John ... I float in liquid gardens
    UTC -7ąDS

  6. #6
    New Lounger
    Join Date
    Apr 2001
    Location
    Dallas, Texas, USA
    Posts
    24
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Comparing Text (Off 97/XP Pro SP1)

    Thanks to each of you for your suggestions. You've helped me get it working just fine now!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •