Not sure if vlookup or index formula is needed

DavidMWright

New Member
Joined
Jul 9, 2018
Messages
5
Good day,

I am hoping somebody can help me.

I have 2 tabs, as shown below. I am trying to copy column C (Name) from tab2 to column C (Name) on tab1 where columns A (ID) match.

Now the above I can do using a vlookup but where I am failing is that it needs to copy the value from the row where column B (Date) on tab2 is the nearest date (same date or in future) of column B (Date) on tab1.

Tab1
ID

<tbody>
</tbody>
DateName
001A000000GISbdIAH

<tbody>
</tbody>
01/01/2017

<tbody>
</tbody>
001A000000GISTtIAP
01/01/2017

<tbody>
</tbody>
001G000000f4KfyIAE

<tbody>
</tbody>
01/01/2017

<tbody>
</tbody>
001A000000GISVSIA5

<tbody>
</tbody>
02/01/2017

<tbody>
</tbody>
001G000000oOGP4IAO

<tbody>
</tbody>
24/01/2017

<tbody>
</tbody>

<tbody>
</tbody>


Tab2
IDDateName
0011600001mEulTAAS

<tbody>
</tbody>
13/07/2015

<tbody>
</tbody>
Adam
0011600001mEulTAAS

<tbody>
</tbody>
16/02/2016

<tbody>
</tbody>
John
0011600001mEulTAAS

<tbody>
</tbody>
26/01/2018

<tbody>
</tbody>
Dave
0011600001mEulTAAS

<tbody>
</tbody>
29/06/2018

<tbody>
</tbody>
Steve
0011600001nRtIxAAK

<tbody>
</tbody>
20/10/2017

<tbody>
</tbody>
Michael

<tbody>
</tbody>

Hope that makes sense.

Greatly appreciate any help.

Dave
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
Hi Dave.
Given that your data starts on A1 on both tabs, here is what I got:
Code:
=IFERROR(INDEX('T2'!C$2:C$6,MATCH('T1'!A2,'T2'!A$2:A$6,0),1),"")
Cheers
PS - Is it possible for John, Dave, and Steve to have the same ID? Also, in you sample data, none of the IDs match. :eek: Could that be the reason you can't get your formulas to work?
 
Last edited:
Upvote 0
Thanks, I will test that.

Yes they could have the same id.

The data I used was just for test purposes and clearly not the best example!
 
Upvote 0
Sorry just did a further test and it is using the oldest date, whereas it should use the same date or greater.

Are you able to update the formula?
 
Upvote 0
I don't know the situation nor the desired results, but generally speaking, having more than one person with the same ID will not give you accurate results, for you will always get the first one found--John, in this case. What if it's Dave or Steve you need for an answer? I guess you could always add the Date criteria and hopefully that doesn't coincide as well.
 
Upvote 0
The ID's are not name ID's. So the request is to copy the Name field where the ID's match, taking the name from the row with the closest date date match (same or greater).

I have found a similar previous question which was answered which I am attempting to tweak for my requirement.

Greatly appreciate your time and effort.
 
Upvote 0

Forum statistics

Threads
1,215,219
Messages
6,123,681
Members
449,116
Latest member
HypnoFant

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