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 |
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 |
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 |
All times are GMT +1. The time now is 06:06 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com