Spreadsheet: 689854d1596708025-multiple-lookups-ordered-by-timestamp-lookup-example
Sheet: Sheet1

Table 1 |  |  |  |  |  | Table 2 |  |  | 1 | 2 | 1 | 2 | 1 | 2 | 1 | 2 | 1 | 2 | 1 | 2 | 1 | 1 | 1 | 1 | <- Order
Phase1, 2, 3 | Code | Created On | Created At | Result |  | Phase1 | Phase2 | Phase3 | A | A | B | B | C | C | D | D | E | E | F | F | G | H | I | J | <- Code
123456 | A | 2018-11-12 00:00:00 | 09:38:20 | 0.001 |  | 123456 | 123458 | 123460
123456 | A | 2018-11-12 00:00:00 | 09:38:21 | 0.002 |  | 123456 | 123458 | 123460
123456 | B | 2018-11-12 00:00:00 | 09:38:59 | 0.003 |  | 123456 | 123458 | 123460
123456 | B | 2018-11-12 00:00:00 | 09:38:59 | 0.004 |  | 123456 | 123458 | 123460
123457 | A | 2018-11-12 00:00:00 | 09:41:25 | 0.005 |  | 123457 | 123459 | 123461
123457 | A | 2018-11-12 00:00:00 | 09:41:25 | 0.006 |  | 123457 | 123459 | 123461
123457 | B | 2018-11-12 00:00:00 | 09:41:25 | 0.007 |  | 123457 | 123459 | 123461
123457 | B | 2018-11-12 00:00:00 | 09:41:25 | 0.008 |  | 123457 | 123459 | 123461
123458 | C | 2018-11-12 00:00:00 | 09:41:25 | 0.009
123458 | D | 2018-11-12 00:00:00 | 10:44:54 | 0.01
123458 | C | 2018-11-12 00:00:00 | 10:48:44 | 0.011 |  | Transfer results from Table 1 to Table 2 by:
123458 | D | 2018-11-12 00:00:00 | 10:48:44 | 0.012
123459 | C | 2018-11-12 00:00:00 | 10:48:44 | 0.013 |  | For each row in Table2, match either of Phase1, Phase2 and Phase3 with the column Phase1, 2, 3 in Table1.
123459 | D | 2018-11-12 00:00:00 | 10:47:01 | 0.014 |  | For each column in Table2, match the Codes with the Codes in Table1.
123459 | C | 2018-11-12 00:00:00 | 10:50:29 | 0.015 |  | For each coulmn in Table2, match the [NAME] number for the given Code with the timestamp in columns Created On and Created At in Table1.
123459 | D | 2018-11-12 00:00:00 | 10:52:22 | 0.016 |  | The oldest timestamp shall give the lowest order number for the given code.
123460 | E | 2018-11-12 00:00:00 | 10:50:52 | 0.017 |  | If there are duplicate timestamps for a given match, both shall be counted with and the first occurrence shall return the first occurring result value and the next one(s) shall return the succeeding result value(s).
123460 | F | 2018-11-12 00:00:00 | 10:51:36 | 0.018
123460 | F | 2018-11-12 00:00:00 | 10:51:36 | 0.019 |  | Table 2 |  |  | 1 | 2 | 1 | 2 | 1 | 2 | 1 | 2 | 1 | 2 | 1 | 2 | 1 | 1 | 1 | 1 | <- Order
123460 | E | 2018-11-12 00:00:00 | 10:51:36 | 0.02 |  | Phase1 | Phase2 | Phase3 | A | A | B | B | C | C | D | D | E | E | F | F | G | H | I | J | <- Code
123461 | G | 2018-11-12 00:00:00 | 10:51:47 | 0.021 |  | 123456 | 123458 | 123460 | 0.001 | 0.002 | 0.003 | 0.004 | 0.009 | 0.011 | 0.01 | 0.012 | 0.017 | 0.02 | 0.018 | 0.019
123461 | H | 2018-11-13 00:00:00 | 07:26:18 | 0.022 |  | 123456 | 123458 | 123460 | 0.001 | 0.002 | 0.003 | 0.004 | 0.009 | 0.011 | 0.01 | 0.012 | 0.017 | 0.02 | 0.018 | 0.019
123461 | I | 2018-11-12 00:00:00 | 09:15:13 | 0.023 |  | 123456 | 123458 | 123460 | 0.001 | 0.002 | 0.003 | 0.004 | 0.009 | 0.011 | 0.01 | 0.012 | 0.017 | 0.02 | 0.018 | 0.019
123461 | J | 2018-11-12 00:00:00 | 09:15:13 | 0.024 |  | 123456 | 123458 | 123460 | 0.001 | 0.002 | 0.003 | 0.004 | 0.009 | 0.011 | 0.01 | 0.012 | 0.017 | 0.02 | 0.018 | 0.019
 |  |  |  |  |  | 123457 | 123459 | 123461 | 0.005 | 0.006 | 0.007 | 0.008 | 0.013 | 0.015 | 0.014 | 0.016 |  |  |  |  | 0.021 | 0.022 | 0.023 | 0.024
 |  |  |  |  |  | 123457 | 123459 | 123461 | 0.005 | 0.006 | 0.007 | 0.008 | 0.013 | 0.015 | 0.014 | 0.016 |  |  |  |  | 0.021 | 0.022 | 0.023 | 0.024
 |  |  |  |  |  | 123457 | 123459 | 123461 | 0.005 | 0.006 | 0.007 | 0.008 | 0.013 | 0.015 | 0.014 | 0.016 |  |  |  |  | 0.021 | 0.022 | 0.023 | 0.024
 |  |  |  |  |  | 123457 | 123459 | 123461 | 0.005 | 0.006 | 0.007 | 0.008 | 0.013 | 0.015 | 0.014 | 0.016 |  |  |  |  | 0.021 | 0.022 | 0.023 | 0.024