MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Checking a range of cells for a value


Posted by M Walker on July 12, 2001 11:52 AM

Hi,

I have a spreadsheet that contains a range of values. i would like to check these values and get any that have a value below a determined level to show up in a text box which can then be printed or emialed.

Someone has mentioned a vlookup but i don't know anything about that - is there an easier option?

Thanks in advance.

M Walker


Posted by tv on July 12, 2001 2:47 PM

try this.

Function fuzzymatch(ByVal input1 As String, ByVal input2 As String)

Dim words(16) As String

wordstart = 1
wordnum = 1

For Count = 1 To Len(input1)
If Count = Len(input1) Then
words(wordnum) = Mid(input1, wordstart, Count - wordstart + 1)
Exit For
End If

If Mid(input1, Count, 1) = " " Then
words(wordnum) = Mid(input1, wordstart, Count - wordstart)
wordnum = wordnum + 1
wordstart = Count + 1
End If
Next

For Count = 1 To wordnum
If InStr(input2, words(Count)) > 0 Then
resultnum = resultnum + Len(words(Count)) * (10 - Count)
resultword = resultword & " " & words(Count)
End If
Next

fuzzymatch = resultnum & resultword

End Function