Vlookup strings - Different types of matches in Data

%3CLINGO-SUB%20id%3D%22lingo-sub-1222092%22%20slang%3D%22en-US%22%3EVlookup%20strings%20-%20Different%20types%20of%20matches%20in%20Data%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1222092%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20all%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20am%20struggling%20to%20figure%20out%20how%20to%20String%20Vlookup%20based%20on%20wildcards.%20Please%20see%20the%20image%20I%20attached%20to%20understand%20the%20problem.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAs%20you%20can%20see%20from%20the%20red%20highlighted%20text%2C%20I%20want%20to%20look%20up%20text%20in%20A10%20in%20the%20table%20in%20P%2C%20Q%20columns.%20The%20cell%20A10%20contains%20%22Mahendra%20Singh%20Dhoni%22.%20However%2C%20my%20table%20has%20%22MS%20Dhoni%22%20in%20it.%20Hence%20the%20formula%20doesn't%20return%20the%20required%20value.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWith%20Wildcards%2C%26nbsp%3B%20I%20have%20used%20the%20Vlookup%20formula%20%3DIFNA(VLOOKUP(%3CSTRONG%3E%22*%22%26amp%3BA10%26amp%3B%22*%22%3C%2FSTRONG%3E%2C%24P%242%3A%24Q%24101%2C2%2CFALSE)%2C%220%22)%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20understood%20that%20if%20my%20table%20has%20any%20text%20before%20and%20after%20%22Mahendra%20Singh%20Dhoni%22%2C%20it%20will%20return%20the%20value%20as%20per%20CONTAINS%20logic.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIs%20there%20a%20way%20to%20get%20the%20value%20if%20one%20word%20in%20A10%20matches%20with%20that%20in%20the%20table%3F%20(i.e.%20to%20match%20based%20on%20the%20word%20'Dhoni'%20in%20A10)%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%20in%20advance!%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EVJ%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1222092%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EFormulas%20and%20Functions%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EOffice%20365%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1222597%22%20slang%3D%22en-US%22%3ERe%3A%20Vlookup%20strings%20-%20Different%20types%20of%20matches%20in%20Data%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1222597%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F579292%22%20target%3D%22_blank%22%3E%40Vijay123%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EA%20very%20difficult%20lookup%20because%20the%20lookup%20value%20contains%20more%20text%20than%20what%20you're%20looking%20for%20in%20the%20table%20array.%26nbsp%3B%20Additionally%2C%20there's%20the%20%22MS%22%20abbreviation.%26nbsp%3B%20I%20think%20what%20you're%20left%20with%20is%20using%20extraction%20formulas%20(LEFT%2C%20RIGHT%2C%20MID)%20with%20wildcards%20to%20do%20the%20lookup%20-%20it's%20very%20risky.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1222671%22%20slang%3D%22en-US%22%3ERe%3A%20Vlookup%20strings%20-%20Different%20types%20of%20matches%20in%20Data%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1222671%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F579292%22%20target%3D%22_blank%22%3E%40Vijay123%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ETo%20supplement%20what%20%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F428790%22%20target%3D%22_blank%22%3E%40Patrick2788%3C%2FA%3E%20has%20already%20said%2C%20your%20situation%20is%20a%20good%20argument%20for%20always%20designing%20data%20tables--when%20names%20are%20concerned--such%20that%20there%20are%20separate%20columns%20for%20FIRST%2C%20MIDDLE%20and%20LAST%20names%2C%20rather%20than%20putting%20them%20all%20together%20in%20one.%20It's%20far%20easier%20to%20do%20all%20kinds%20of%20things%20with%20them%20separated%20(for%20example%2C%20sort%20alphabetically%20by%20last%20name%3B%20assemble%20lists%20alphabetically%20by%20last%20name%3B%20print%20name%20name%20cards%20with%20first%20name%20first%2C%20etc.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIf%20I%20were%20you%20in%20this%20case%2C%20assuming%20you%20are%20going%20to%20want%20to%20do%20this%20kind%20of%20lookup%20with%20all%20the%20names%2C%20why%20don't%20you%20take%20time%2C%20using%20LEFT%2C%20MID%2C%20and%20RIGHT%20functions%2C%20to%20break%20the%20names%20apart%20into%20separate%20columns.%3C%2FP%3E%3C%2FLINGO-BODY%3E
Occasional Visitor

Hi all,

 

I am struggling to figure out how to String Vlookup based on wildcards. Please see the image I attached to understand the problem.

 

As you can see from the red highlighted text, I want to look up text in A10 in the table in P, Q columns. The cell A10 contains "Mahendra Singh Dhoni". However, my table has "MS Dhoni" in it. Hence the formula doesn't return the required value.

 

With Wildcards,  I have used the Vlookup formula =IFNA(VLOOKUP("*"&A10&"*",$P$2:$Q$101,2,FALSE),"0")

 

I understood that if my table has any text before and after "Mahendra Singh Dhoni", it will return the value as per CONTAINS logic.

 

Is there a way to get the value if one word in A10 matches with that in the table? (i.e. to match based on the word 'Dhoni' in A10)

 

Thanks in advance!

 

VJ

2 Replies

@Vijay123 

A very difficult lookup because the lookup value contains more text than what you're looking for in the table array.  Additionally, there's the "MS" abbreviation.  I think what you're left with is using extraction formulas (LEFT, RIGHT, MID) with wildcards to do the lookup - it's very risky.

@Vijay123 

 

To supplement what @Patrick2788 has already said, your situation is a good argument for always designing data tables--when names are concerned--such that there are separate columns for FIRST, MIDDLE and LAST names, rather than putting them all together in one. It's far easier to do all kinds of things with them separated (for example, sort alphabetically by last name; assemble lists alphabetically by last name; print name name cards with first name first, etc.

 

If I were you in this case, assuming you are going to want to do this kind of lookup with all the names, why don't you take time, using LEFT, MID, and RIGHT functions, to break the names apart into separate columns.