Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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.


--
srs710
------------------------------------------------------------------------
srs710's Profile: http://www.excelforum.com/member.php...o&userid=25377
View this thread: http://www.excelforum.com/showthread...hreadid=388577

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default 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" wrote in
message ...

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,339
Default 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
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
comparing two columns of data and return unique data in another co ExcelUSER Excel Discussion (Misc queries) 6 June 18th 09 02:10 PM
comparing data newyorkjoy Excel Discussion (Misc queries) 7 August 3rd 07 12:03 PM
help comparing two sets od data to find the odd data matsgullis Excel Worksheet Functions 2 January 12th 06 01:52 AM
comparing lists of data to remove duplicate data Tom Excel Discussion (Misc queries) 2 October 13th 05 06:16 PM
Comparing data in two columns and highlighting the data David Kinsley Excel Worksheet Functions 6 January 4th 05 06:01 PM


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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"