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.
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).
If no 'event' happens, then the value should be the value closest to before the specified time period. So it should look like this:
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
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 | |||||
---|---|---|---|---|---|
A | B | C | |||
1 | ID | Date | Value | ||
2 | 1 | 12/01/2008 | E12 | ||
3 | 1 | 16/02/2008 | E14 | ||
4 | 1 | 22/04/2008 | E16 | ||
5 | 1 | 28/08/2008 | E08 | ||
6 | 1 | 03/02/2009 | E32 | ||
7 | 1 | 19/08/2009 | E13 | ||
8 | 2 | 04/03/2012 | E14 | ||
9 | 2 | 06/06/2012 | E12 | ||
10 | 2 | 07/06/2012 | E16 | ||
11 | 3 | 29/07/2011 | E12 | ||
12 | 4 | 08/06/2009 | E01 | ||
13 | 5 | 09/01/2008 | E14 | ||
14 | 5 | 24/04/2008 | E12 | ||
15 | 5 | 28/08/2008 | E18 | ||
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 | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
A | B | C | D | E | F | G | H | I | |||
1 | ID | Index date | Index Value | 3 month value | Value 3 months | 6 month value | Value 6 months | 12 month value | Value 12 months | ||
2 | 1 | 12/01/2008 | E12 | 12/04/2008 | 12/07/2008 | 12/01/2009 | |||||
3 | 2 | 04/03/2012 | E14 | 04/06/2012 | 04/09/2012 | 04/03/2013 | |||||
4 | 3 | 29/07/2011 | E12 | 29/10/2011 | 29/01/2012 | 29/07/2012 | |||||
5 | 4 | 08/06/2009 | E01 | 08/09/2009 | 08/12/2009 | 08/06/2010 | |||||
6 | 5 | 09/01/2008 | E14 | 09/04/2008 | 09/07/2008 | 09/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 | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
A | B | C | D | E | F | G | H | I | |||
1 | ID | Index date | Index Value | 3 month value | Value 3 months | 6 month value | Value 6 months | 12 month value | Value 12 months | ||
2 | 1 | 12/01/2008 | E12 | 12/04/2008 | E16 | 12/07/2008 | E08 | 12/01/2009 | E32 | ||
3 | 2 | 04/03/2012 | E14 | 04/06/2012 | E12 | 04/09/2012 | E16 | 04/03/2013 | E16 | ||
4 | 3 | 29/07/2011 | E12 | 29/10/2011 | E12 | 29/01/2012 | E12 | 29/07/2012 | E12 | ||
5 | 4 | 08/06/2009 | E01 | 08/09/2009 | 08/12/2009 | 08/06/2010 | |||||
6 | 5 | 09/01/2008 | E14 | 09/04/2008 | 09/07/2008 | 09/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