Return a value if the date corresponding to the value is greater than a set date and matches other criteria

confusedsteve

New Member
Joined
Oct 13, 2014
Messages
1
Hello,

I have a dataset in long format with multiple entries per ID. For each ID there are multiple dates of an event, and a value corresponding to that event.


Book1
ABC
1IDDateValue
2112/01/2008E12
3116/02/2008E14
4122/04/2008E16
5128/08/2008E08
6103/02/2009E32
7119/08/2009E13
8204/03/2012E14
9206/06/2012E12
10207/06/2012E16
11329/07/2011E12
12408/06/2009E01
13509/01/2008E14
14524/04/2008E12
15528/08/2008E18
Sheet1


In a seperate sheet I have one entry for each ID, and need to return the FIRST correct value that falls between certain time periods (3, 6, and 12 months after their index date).


Book1
ABCDEFGHI
1IDIndex dateIndex Value3 month valueValue 3 months6 month valueValue 6 months12 month valueValue 12 months
2112/01/2008E1212/04/200812/07/200812/01/2009
3204/03/2012E1404/06/201204/09/201204/03/2013
4329/07/2011E1229/10/201129/01/201229/07/2012
5408/06/2009E0108/09/200908/12/200908/06/2010
6509/01/2008E1409/04/200809/07/200809/01/2009
Sheet2


If no 'event' happens, then the value should be the value closest to before the specified time period. So it should look like this:


Book1
ABCDEFGHI
1IDIndex dateIndex Value3 month valueValue 3 months6 month valueValue 6 months12 month valueValue 12 months
2112/01/2008E1212/04/2008E1612/07/2008E0812/01/2009E32
3204/03/2012E1404/06/2012E1204/09/2012E1604/03/2013E16
4329/07/2011E1229/10/2011E1229/01/2012E1229/07/2012E12
5408/06/2009E0108/09/200908/12/200908/06/2010
6509/01/2008E1409/04/200809/07/200809/01/2009
Sheet2


The database has around 60 thousand entries for 40 thousand IDs so would need a single formula that works for all instances.

Any help would be greatly appreciated.

Thanks

Steve
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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