VBA – How to Exact Match a Value in Raw String in Excel

microsoft excelvba

I am trying to create a function which match the exact value in the raw string if macthes then paste the value but here Lookup function is giving an wrong answer.

I know how to extract it using Left function but how to macth exact string like in VBA we use Criteria: "" & CellValue & "".

=LOOKUP(99^99,SEARCH($K$3:$K$97,A3),$K$3:$K$97)

This function is not matching exact string as you can see in attached picture.

enter image description here

Best Answer

book ends the values with spaces, and lookup is probably not the best tool for this:

=INDEX($K:$K,AGGREGATE(15,7,ROW($K$3:$K$97)/(ISNUMBER(SEARCH(" "&$K$3:$K$97&" "," "&A3&" "))),1)
Related Question