VLOOKUP - how to search for only part of the Lookup Value

chimp_spanner

New Member
Joined
May 6, 2020
Messages
6
Office Version
  1. 365
Platform
  1. MacOS
Hey everyone! Hoping someone can help me here. I've asked over at Reddit but still can't quite get to where I wanna be.

Screenshot 2020-05-06 at 11.52.49.png


The attached image should show what I'm trying to do. Obviously in practice the array would be on a separate worksheet. In the Mix Type bit I've manually typed in what I'd like the formula to return based on the lookup. So with the array defined as a range called Mix_Type, the formula is;

=vlookup(A2,Mix_Type,2,FALSE)

When I do this I get #N/A. If I set to TRUE, every file returns "Radio Edit".

I think I know what the problem is in as much as it's showing #N/A because there's nothing in the first column of the array with that exact name (every song on an album has a different name). How can I get it to match a file name to a mix type if it contains a relevant word anywhere in the lookup value?

It's complicated in that the file names are always different lengths. And there are also multiple variants on each file according to length, so for example;

ALIBI-Happy Days_Full w Lyrical Male Vox
ALIBI-Happy Days_Full w Lyrical Male Vox_5
ALIBI-Happy Days_Full w Lyrical Male Vox_15
ALIBI-Happy Days_Full w Lyrical Male Vox_30

I'm not really great at Excel so if possible, please explain it to me like I'm five haha. Thanks so much in advance for any assistance!!
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
Hi Chimp_Spanner,

A wildcard ("*") will let you do a search on part of a string but you have the added complication of some terms appearing twice so a simple search will just return the first hit.

Book2
AB
1Track TitleMix Type
2Boom-Boom Lyrical Female VoxVocal Mix
3Tea for TwoRadio Edit
4Bones_Stem VoxStem
5Boom-Boom Lyrical FemaleRadio Edit
6
7
8
9Find in Track TitleShow in Mix Type
10Lyrical Male#N/A
11Lyrical FemaleVocal Mix
12VoxVocal Mix
13_STEMStem
Sheet1
Cell Formulas
RangeFormula
B10:B13B10=INDEX($B$2:$B$6,MATCH("*"&A10&"*",$A$2:$A$6,0))


If you could copy&paste your cells it would make it easier for people rather than posting an image.
 
Upvote 0
Hi Chimp_Spanner,

A wildcard ("*") will let you do a search on part of a string but you have the added complication of some terms appearing twice so a simple search will just return the first hit.

Book2
AB
1Track TitleMix Type
2Boom-Boom Lyrical Female VoxVocal Mix
3Tea for TwoRadio Edit
4Bones_Stem VoxStem
5Boom-Boom Lyrical FemaleRadio Edit
6
7
8
9Find in Track TitleShow in Mix Type
10Lyrical Male#N/A
11Lyrical FemaleVocal Mix
12VoxVocal Mix
13_STEMStem
Sheet1
Cell Formulas
RangeFormula
B10:B13B10=INDEX($B$2:$B$6,MATCH("*"&A10&"*",$A$2:$A$6,0))


If you could copy&paste your cells it would make it easier for people rather than posting an image.

Hey Toadstool! Thanks so much for the reply, and apologies for posting an image instead of cells (new here!). I'll paste below if it helps;

Track TitleMix TypeFind ItShow It
ALIBI-Summer Vibes_Full w Lyrical Male VoxLyricalVocal Mix
ALIBI-Summer Vibes_Instrumental MixVoxInstrumental Mix
ALIBI-Summer Vibes_Rhythm Mix_InstrumentalInstrumental Mix
ALIBI-Summer Vibes_Sparse Mix_Rhythm MixRhythm Mix
ALIBI-Summer Vibes_Sparse Rhythm Mix_Sparse MixSparse Mix
ALIBI-Summer Vibes_Drums and Bass Mix_Sparse Rhythm MixSparse Rhythm Mix
ALIBI-Summer Vibes_Drums and FX Mix_Drums andDrums and Bass Mix
ALIBI-Summer Vibes_Holiday Mix_HolidayHoliday Mix
ALIBI-Summer Vibes_Radio Edit_RadioRadio Edit
ALIBI-Summer Vibes_STEM Guitars_STEMStem
ALIBI-Summer Vibes_STEM Vox
ALIBI-Summer Vibes_STEM FX
ALIBI-Forgotten Dreams_Full w Vox Samples
ALIBI-Forgotten Dreams_Instrumental Mix
ALIBI-Forgotten Dreams_Rhythm Mix
ALIBI-Forgotten Dreams_Sparse Mix
ALIBI-Forgotten Dreams_Sparse Rhythm Mix
ALIBI-Forgotten Dreams_Drums and Bass Mix
ALIBI-Forgotten Dreams_Holiday Mix
ALIBI-Forgotten Dreams_Radio Edit
ALIBI-Forgotten Dreams_STEM Drums
ALIBI-Forgotten Dreams_STEM Vox Samples
ALIBI-Forgotten Dreams_STEM Violins

Didn't quite follow the example you gave, although interesting that you're using INDEX and MATCH as I hadn't looked into those. Ultimately the goal is that I can have a formula that I can just Fill Down from B2:Bx.
 
Upvote 0
Also i realise that I might run into trouble having Full w Vox being instrumental, while Full w Lyrical Vox being vocal. But I'm hoping if it does it by what it encounters first, I should be okay. As the file names are always presented in this order (I do this first in another program).
 
Upvote 0
See if this helps. Note that I've swapped the entries for 'Vox' and 'Lyrical' in the 'Find it' and 'Show it' columns. Where 2 (or more) possible matches could be found, the match with the higher priority needs to be lower in the list.
The List.xlsx
ABCD
1Track TitleMix TypeFind ItShow It
2ALIBI-Summer Vibes_Full w Lyrical Male VoxVocal MixVoxInstrumental Mix
3ALIBI-Summer Vibes_Instrumental MixInstrumental MixLyricalVocal Mix
4ALIBI-Summer Vibes_Rhythm MixRhythm Mix_InstrumentalInstrumental Mix
5ALIBI-Summer Vibes_Sparse MixSparse Mix_Rhythm MixRhythm Mix
6ALIBI-Summer Vibes_Sparse Rhythm MixSparse Rhythm Mix_Sparse MixSparse Mix
7ALIBI-Summer Vibes_Drums and Bass MixDrums and Bass Mix_Sparse Rhythm MixSparse Rhythm Mix
8ALIBI-Summer Vibes_Drums and FX MixDrums and Bass Mix_Drums andDrums and Bass Mix
9ALIBI-Summer Vibes_Holiday MixHoliday Mix_HolidayHoliday Mix
10ALIBI-Summer Vibes_Radio EditRadio Edit_RadioRadio Edit
11ALIBI-Summer Vibes_STEM GuitarsStem_STEMStem
12ALIBI-Summer Vibes_STEM VoxStem
13ALIBI-Summer Vibes_STEM FXStem
14ALIBI-Forgotten Dreams_Full w Vox SamplesInstrumental Mix
15ALIBI-Forgotten Dreams_Instrumental MixInstrumental Mix
16ALIBI-Forgotten Dreams_Rhythm MixRhythm Mix
17ALIBI-Forgotten Dreams_Sparse MixSparse Mix
18ALIBI-Forgotten Dreams_Sparse Rhythm MixSparse Rhythm Mix
19ALIBI-Forgotten Dreams_Drums and Bass MixDrums and Bass Mix
20ALIBI-Forgotten Dreams_Holiday MixHoliday Mix
21ALIBI-Forgotten Dreams_Radio EditRadio Edit
22ALIBI-Forgotten Dreams_STEM DrumsStem
23ALIBI-Forgotten Dreams_STEM Vox SamplesStem
24ALIBI-Forgotten Dreams_STEM ViolinsStem
Sheet15
Cell Formulas
RangeFormula
B2:B24B2=LOOKUP(2,1/ISNUMBER(SEARCH($C$2:$C$11,A2)),$D$2:$D$11)
 
Upvote 0
See if this helps. Note that I've swapped the entries for 'Vox' and 'Lyrical' in the 'Find it' and 'Show it' columns. Where 2 (or more) possible matches could be found, the match with the higher priority needs to be lower in the list.
The List.xlsx
ABCD
1Track TitleMix TypeFind ItShow It
2ALIBI-Summer Vibes_Full w Lyrical Male VoxVocal MixVoxInstrumental Mix
3ALIBI-Summer Vibes_Instrumental MixInstrumental MixLyricalVocal Mix
4ALIBI-Summer Vibes_Rhythm MixRhythm Mix_InstrumentalInstrumental Mix
5ALIBI-Summer Vibes_Sparse MixSparse Mix_Rhythm MixRhythm Mix
6ALIBI-Summer Vibes_Sparse Rhythm MixSparse Rhythm Mix_Sparse MixSparse Mix
7ALIBI-Summer Vibes_Drums and Bass MixDrums and Bass Mix_Sparse Rhythm MixSparse Rhythm Mix
8ALIBI-Summer Vibes_Drums and FX MixDrums and Bass Mix_Drums andDrums and Bass Mix
9ALIBI-Summer Vibes_Holiday MixHoliday Mix_HolidayHoliday Mix
10ALIBI-Summer Vibes_Radio EditRadio Edit_RadioRadio Edit
11ALIBI-Summer Vibes_STEM GuitarsStem_STEMStem
12ALIBI-Summer Vibes_STEM VoxStem
13ALIBI-Summer Vibes_STEM FXStem
14ALIBI-Forgotten Dreams_Full w Vox SamplesInstrumental Mix
15ALIBI-Forgotten Dreams_Instrumental MixInstrumental Mix
16ALIBI-Forgotten Dreams_Rhythm MixRhythm Mix
17ALIBI-Forgotten Dreams_Sparse MixSparse Mix
18ALIBI-Forgotten Dreams_Sparse Rhythm MixSparse Rhythm Mix
19ALIBI-Forgotten Dreams_Drums and Bass MixDrums and Bass Mix
20ALIBI-Forgotten Dreams_Holiday MixHoliday Mix
21ALIBI-Forgotten Dreams_Radio EditRadio Edit
22ALIBI-Forgotten Dreams_STEM DrumsStem
23ALIBI-Forgotten Dreams_STEM Vox SamplesStem
24ALIBI-Forgotten Dreams_STEM ViolinsStem
Sheet15
Cell Formulas
RangeFormula
B2:B24B2=LOOKUP(2,1/ISNUMBER(SEARCH($C$2:$C$11,A2)),$D$2:$D$11)

^ Mate. I have been banging my head against the desk ALL day and that appears to have done it perfectly. Gonna test it out in a few different scenarios but it looks like you nailed it. Thank you!!!!
 
Upvote 0
See if this helps. Note that I've swapped the entries for 'Vox' and 'Lyrical' in the 'Find it' and 'Show it' columns. Where 2 (or more) possible matches could be found, the match with the higher priority needs to be lower in the list.

Just a couple of quick follow up questions. I got it working when everything's on one sheet. I'm trying to do it with the search/return table on another sheet and it's giving me a #N/A. Do I have to change something in that initial part (2,1/ISNUMBER) and what are they actually doing? Thanks!
 
Upvote 0
Nevermind, I'm an idiot. I tried putting the formula into my main data sheet and lookup value was blank because I hadn't imported any data yet. It's been a long day :D Apologies for the multi posts - I can't figure out how to edit/delete posts.
 
Upvote 0
To (try to) explain how it works,
SEARCH(list, title) creates an array of numbers (list item found in title) or errors (item not found).
ISNUMBER converts numbers to TRUE and errors to FALSE.
LOOKUP(2,1/ finds the postition of the last TRUE match i the list by converting the FALSE results back to errors.
It would work here without ISNUMBER, I just added it to the formula out of habit. There are times when it might be needed but here it is not necessary.

As for editing posts, there is an 'edit' link in the bottom left corner of each post (next to report) but you only get a 10 minute window to edit and save from when you first submit the post.
Deleting posts is not possible, that can only be done by admin, usually only posts that break the rules get edited or deleted, (hopefully I'm not breaking rule 9 here) ?
 
Upvote 0

Forum statistics

Threads
1,220,965
Messages
6,157,119
Members
451,398
Latest member
rjsteward

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top