Excel 2010 - I have data that is in the following format. It is sorted in date order, ascending.
In another worksheet, I have a list of key values & need a function to do a recursive lookup. In my worksheet, when a part number is entered, I need for the lookup to go through the list (above) and return the most recent <b>newKeyVal</b> for which there are no newer entries.
In the above, when <b>keyVal</b> 2519504006 is entered, the <u>correct</u> <b>newKeyVal</b> to be returned is <b> 0-4087</b>. The lookup would look up the 2519504006 value in <b>keyVal</b>, retrieve the <b>newKeyVal</b> 0-4092, then lookup <b>keyVal</b> 0-4092 & return <b>newKeyVal</b> 0-4087, since that date-time stamp is the last one in the sequence for which there is no newer entry.
The data in the table is a tracking of how the key values change. To "correct" an entry, a new <b>keyVal - newKeyVal</b> entry will be made. For example, if we have A --> B --> C, and determine that the B --> C entry is incorrect, a <u>new</u> <b>keyVal</b> of C with a <b>newKeyVal</b> of B would be entered. The sequence would then be A --> B ---> C --> B. The date time of the A --> B entry would be the oldest, and the C --> B entry would be the newest.
I have a function that doesn't quite work - it will return the correct value only if the entries are in order, but it won't return the correct value for the above. The correct <b>newKeyVal</b> for part 2519504006 should be 0-4087. A11 --> C11 & A8 --> C8.
I can post the function I have if it would be helpful.
Excel 2010 | |||||
---|---|---|---|---|---|
A | B | C | |||
1 | keyVal | date | newKeyVal | ||
2 | 0-4087 | 2016-02-17 13:40:21.843 | 0B4105 | ||
3 | 0-4092 | 2016-02-17 13:40:21.970 | 044-619 | ||
4 | 0-4087 | 2016-02-17 13:40:22.017 | 044-619 | ||
5 | 0B4105 | 2016-02-17 13:40:22.017 | 044-619 | ||
6 | 0B4105 | 2016-02-17 13:40:23.923 | 0-4087 | ||
7 | 0-4087 | 2016-02-17 13:40:23.923 | 0-4087 | ||
8 | 0-4092 | 2016-02-17 13:40:23.923 | 0-4087 | ||
9 | 044-619 | 2016-02-17 13:40:23.937 | 0-4087 | ||
10 | 19504006 | 2016-02-17 13:41:07.220 | 0-4092 | ||
11 | 2519504006 | 2016-02-17 13:41:07.220 | 0-4092 | ||
Sheet1 |
In another worksheet, I have a list of key values & need a function to do a recursive lookup. In my worksheet, when a part number is entered, I need for the lookup to go through the list (above) and return the most recent <b>newKeyVal</b> for which there are no newer entries.
In the above, when <b>keyVal</b> 2519504006 is entered, the <u>correct</u> <b>newKeyVal</b> to be returned is <b> 0-4087</b>. The lookup would look up the 2519504006 value in <b>keyVal</b>, retrieve the <b>newKeyVal</b> 0-4092, then lookup <b>keyVal</b> 0-4092 & return <b>newKeyVal</b> 0-4087, since that date-time stamp is the last one in the sequence for which there is no newer entry.
The data in the table is a tracking of how the key values change. To "correct" an entry, a new <b>keyVal - newKeyVal</b> entry will be made. For example, if we have A --> B --> C, and determine that the B --> C entry is incorrect, a <u>new</u> <b>keyVal</b> of C with a <b>newKeyVal</b> of B would be entered. The sequence would then be A --> B ---> C --> B. The date time of the A --> B entry would be the oldest, and the C --> B entry would be the newest.
I have a function that doesn't quite work - it will return the correct value only if the entries are in order, but it won't return the correct value for the above. The correct <b>newKeyVal</b> for part 2519504006 should be 0-4087. A11 --> C11 & A8 --> C8.
I can post the function I have if it would be helpful.