Last active
December 16, 2015 21:09
-
-
Save walkergv/5497295 to your computer and use it in GitHub Desktop.
A Simple VBA Excel User Defined Function for adding modified broad match plus signs onto keywords . Also contains a TRUE or FALSE modifier to remove any common word (eg. the, a, for, etc...)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Function MakeModifiedBroadMatch(rng As Range, RemoveCommonWords As Boolean) As String | |
Dim WordList() As String | |
Dim CommonWords() As String: CommonWords = Split("how,do,i,with,in,a,to,the,for,is,of,and,are", ",") | |
Dim i As Integer | |
Dim x As Integer | |
Dim ContainsCommonWord As Boolean | |
Dim ModifiedBroadMatchKeyword As String | |
WordList = Split(rng.Value) | |
ContainsCommonWord = False | |
For i = LBound(WordList) To UBound(WordList) | |
For x = LBound(CommonWords) To UBound(CommonWords) | |
If (LCase(WordList(i)) = LCase(CommonWords(x))) And RemoveCommonWords = True Then | |
ContainsCommonWord = True | |
End If | |
Next x | |
If ContainsCommonWord = False Then | |
ModifiedBroadMatchKeyword = ModifiedBroadMatchKeyword & " +" & WordList(i) | |
End If | |
ContainsCommonWord = False | |
Next i | |
MakeModifiedBroadMatch = LTrim(ModifiedBroadMatchKeyword) | |
End Function |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment