+ Reply to Thread
Results 1 to 3 of 3

Comparing data

  1. #1
    Registered User
    Join Date
    07-20-2005
    Posts
    1

    Comparing data

    I need to compare a word in a single cell to a group of words. If that single word matches any one of the group I'd like to return a "Yes". The group of words are currently in a comma delimited text file so I can arrange them however needed.

    I hope someone can help.

  2. #2
    Norman Jones
    Guest

    Re: Comparing data

    Hi SRS710,

    Try something like::

    Sub Tester()

    Dim sStrWord As String
    Dim arr As Variant

    sStrWord = Range("A1").Value '<<===== CHANGE

    arr = Array("Word1", "Word2", "Word3", "Word4", "Word5")

    MsgBox IIf(Not IsError(Application.Match _
    (sStrWord, arr)), "Yes!", "No!")

    End Sub


    ---
    Regards,
    Norman



    "srs710" <[email protected]> wrote in
    message news:[email protected]...
    >
    > I need to compare a word in a single cell to a group of words. If that
    > single word matches any one of the group I'd like to return a "Yes".
    > The group of words are currently in a comma delimited text file so I
    > can arrange them however needed.
    >
    > I hope someone can help.
    >
    >
    > --
    > srs710
    > ------------------------------------------------------------------------
    > srs710's Profile:
    > http://www.excelforum.com/member.php...o&userid=25377
    > View this thread: http://www.excelforum.com/showthread...hreadid=388577
    >




  3. #3
    Toppers
    Guest

    RE: Comparing data

    Hi,
    Using a formula rather than VBA:

    Place (for example) in B1:

    =IF( ISERROR(MATCH(A1,D1:D20,0)),"No","Yes")


    where A1 contains word to be matched
    D1 to D20 contains list of words to be searched

    MATCH is not case sensitive.

    HTH

    "srs710" wrote:

    >
    > I need to compare a word in a single cell to a group of words. If that
    > single word matches any one of the group I'd like to return a "Yes".
    > The group of words are currently in a comma delimited text file so I
    > can arrange them however needed.
    >
    > I hope someone can help.
    >
    >
    > --
    > srs710
    > ------------------------------------------------------------------------
    > srs710's Profile: http://www.excelforum.com/member.php...o&userid=25377
    > View this thread: http://www.excelforum.com/showthread...hreadid=388577
    >
    >


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1