Newbie question about VLOOKUP & duplicate return values - tried searching, got confused

auralfixstation

New Member
Joined
Sep 12, 2014
Messages
1
Basically, I'm dealing with two different databases of BWAV audio files. One of them (I) reflects my current database, where I have embedded metadata descriptions(I-C), and filenames that are strings of numbers(I-A). The other database (II) has matching embedded descriptions (II-A), but with better filenames (II-C). Both databases also have durations, but they don't match perfectly, and are somehow formatted differently (a whole other topic, it seems).

In trying to pull the filenames from II-C into database I, VLOOKUP gets me some of the way there - the problem is that I'm basically doing (in database I) =VLOOKUP(C1,!'II.csv'$A$1:$C$14,3,FALSE), but there are some duplicate fields in column C, so they only ever return the first instance they come across.

I feel like I need to do something like an INDEXMATCH that will look at both durations and the descriptions - but then there's the issue of the durations not matching perfectly, and being differently formatted - so if there was a way for me to say "match duration within x tolerance". Or, I could try something where it says that if the returned value is already in the column, then look for the next instance of the lookup value.

I realize that I could also just generate my own filenames in the first database, but I'm interested in trying to use some sort of INDEX or other lookup function to do it because I have had other similar scenarios at times.

Oh, and apologies for not using a better formatted tool to show my examples...couldn't get MrExcel HTML to work on Mac Office 2011.

Thank you in advance for any tips!

I - Current database
ABCD
S_02183_001.WAV00:09.5Vocals - Mouth Pops - Int - CU - Various Pitched Hollow Pops
S_02183_002.wav00:06.2Vocals - Mouth Pops - Int - CU - Various Pitched Hollow Pops
S_02183_003.wav00:13.0Vocals - Mouth Pops - Int - CU - Various Pitched Hollow Pops
S_029221.wav00:07.0Pops - Rubber Pops - CU - Quick Pops of Various Pitches, Some Movement
S_029223.wav00:04.0Pops - Bottle Pops - CU - Short Hollow Pops of Various Pitches
S_029596.wav00:21.8Boats Ships - 41' Sailboat Motor - Ext - ECU Start W Splash & Light Rev,Idle, & Engine Off
S_029597.wav02:05.7Boats Ships - 41' Sailboat Motor - Ext - CU Start & Idle W Splashes
S_029598.wav03:02.9Boats Ships - 41' Sailboat - Ext - CU Idle, Short Stop, Into Reverse & Back-up W/ Splashes
S_029599_001.wav02:30.3Boats Ships - 41' Sailboat - Ext - CU Water Trickling Against The Bow
S_029599_002.wav02:09.2Boats Ships - 41' Sailboat - Ext - CU Water Trickling Against The Bow
S_029600.wav02:23.1Backgrounds - Harbor Ambiance - Foghorn Blasts - Periodic Blasts W Light Water Laps
S_029601.wav01:53.9Boats Ships - 41' Sailboat - Ext - MCU Bow Wash W Bg Foghorn

<tbody>
</tbody>
II.
ABC
Vocals - Mouth Pops - Int - CU - Various Pitched Hollow Pops0:06Vocals-MouthPops-Int-CU-V_1.wav
Vocals - Mouth Pops - Int - CU - Various Pitched Hollow Pops0:13Vocals-MouthPops-Int-CU-V_2.wav
Vocals - Mouth Pops - Int - CU - Various Pitched Hollow Pops0:09Vocals-MouthPops-Int-CU-V_3.wav
Pops - Rubber Pops - CU - Quick Pops of Various Pitches, Some Movement0:06Pops-RubberPops-CU-QuickPop.wav
Boats Ships - 41' Sailboat Motor - Ext - ECU Start W Splash & Light Rev,Idle, & Engine Off0:21BoatsShips-41'SailboatMotor.wav
Boats Ships - 41' Sailboat Motor - Ext - CU Start & Idle W Splashes2:05BoatsShips-41'SailboatMot_1.wav
Boats Ships - 41' Sailboat - Ext - CU Idle, Short Stop, Into Reverse & Back-up W/ Splashes3:02BoatsShips-41'Sailboat-Ext.wav
Boats Ships - 41' Sailboat - Ext - CU Water Trickling Against The Bow2:30BoatsShips-41'Sailboat-Ex_1.wav
Boats Ships - 41' Sailboat - Ext - CU Water Trickling Against The Bow2:09BoatsShips-41'Sailboat-Ex_2.wav
Backgrounds - Harbor Ambiance - Foghorn Blasts - Periodic Blasts W Light Water Laps2:23Backgrounds-HarborAmbiance.wav
Boats Ships - 41' Sailboat - Ext - MCU Bow Wash W Bg Foghorn1:53BoatsShips-41'Sailboat-Ex_3.wav

<tbody>
</tbody>
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
Hi and welcome to the forum,

You could try something like this:

{=INDEX($A$15:$C$21,MATCH(1,($A$15:$A$21=A2)*(($B$15:$B$21-0.5)<B2)*(($B$15:$B$21+0.5)>B2),0),3)}

The first thing to note is that the above is an "array formula". So you don't enter the curly brackets or braces at each end "{}". You enter the basic formula then hit Ctrl+Shift+Enter to complete the formula entry - not just Enter as you would normally. Excel has to add the braces itself.

Once the formula is entered properly then it needs to be copied down into all the required rows. (Don't select all the rows first expecting EXCEL to do it all at once. That means something else to Excel and it is not so easy to get out of!)

I put my lookup table in cells A15 to C21 and the data was above it. The A15:C21 data has to be sorted by columns A and B so everything is in increasing order.

What does it do?
It performs an exact comparison on the data in column A. Then it moves to column B and finds the entries which are within 0.5 of the required value. (I used whole numbers. If you are using Excel times they will be in fractions of a day so 0.5 will be 12 hours! You will need to use smaller values. I would suggest that you use Excel time values rather than text strings to represent times. If that is not already the case you will make some data adjustments.) The two numbers, the 0.5s, can be different so you could use +0.5 and -0,1, say.

How does it do it?
=MATCH(1, something, 0) returns the row number where "something" exactly matches the value 1.
In this case "something" has the form: X * Y * Z. There are three terms separated by multiplication signs. The values of X, Y and Z will be either TRUE or FALSE - effectively the same as 1 and 0, respectively.

In fact X, Y and Z will all be arrays so X might look like: TRUE;FALSE;FALSE;FALSE;FALSE
If Y and Z also had a TRUE in position 1 then MATCH would return the row of the first value. If all the second positions were TRUE, instead, then the second row would be returned. Basically, all three terms have to be true for MATCH to return a row.

When INDEX gets that row, it looks up the value in column 3 of that row - that is what the 3 is for near the end of the formula.

I hope that gives you a start.






<colgroup><col width="64"></colgroup><tbody>
</tbody>
 
Upvote 0

Forum statistics

Threads
1,214,585
Messages
6,120,388
Members
448,957
Latest member
Hat4Life

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