I need help in Excel of finding finding the Correct Output based on Amount of four conditional statements of:
- max value of Timestamp;
- if there are duplicate max dates, use the last row of the same Timestamp because the data does not extend upto seconds;
- per month of the Timestamp;
- per (4) unique ID
and leave the other rows blank. The Correct Output column is the expected output.
Here's the sample data:
╔════╦═════════════════════════════╦═════════╦════════════════╦══╦═════════════╦════════════╦═════════╗
║ ID ║ Timestamp (yyyy-mm-dd H:mm) ║ Amount ║ Correct Output ║ ║ Date Format ║ Max Date ║ Test ║
╠════╬═════════════════════════════╬═════════╬════════════════╬══╬═════════════╬════════════╬═════════╣
║ A ║ 2013-04-15 20:42 ║ NULL ║ NULL ║ ║ 2013-04-15 ║ 2013-04-15 ║ NULL ║
║ A ║ 2013-05-23 23:09 ║ 300000 ║ 300000 ║ ║ 2013-05-23 ║ 2013-05-23 ║ 300000 ║
║ A ║ 2013-09-15 23:36 ║ 300000 ║ 300000 ║ ║ 2013-09-15 ║ 2013-09-15 ║ 300000 ║
║ A ║ 2013-12-19 5:58 ║ 300000 ║ ║ ║ 2013-12-19 ║ 2013-12-19 ║ 0 ║
║ A ║ 2013-12-19 6:18 ║ 0 ║ ║ ║ 2013-12-19 ║ 2013-12-19 ║ 0 ║
║ A ║ 2013-12-19 6:18 ║ 0 ║ 0 ║ ║ 2013-12-19 ║ 2013-12-19 ║ 0 ║
║ B ║ 2013-05-23 23:00 ║ NULL ║ ║ ║ 2013-05-23 ║ 2013-05-23 ║ 0 ║
║ B ║ 2013-05-23 23:04 ║ 0 ║ 0 ║ ║ 2013-05-23 ║ 2013-05-23 ║ 0 ║
║ B ║ 2013-05-30 3:48 ║ 2339000 ║ ║ ║ 2013-05-30 ║ 2013-05-30 ║ 1169500 ║
║ B ║ 2013-05-30 3:54 ║ 1169500 ║ 1169500 ║ ║ 2013-05-30 ║ 2013-05-30 ║ 1169500 ║
║ B ║ 2013-06-02 11:46 ║ 2339000 ║ ║ ║ 2013-06-02 ║ 2013-06-02 ║ 2339000 ║
║ B ║ 2013-06-27 8:40 ║ 2339000 ║ ║ ║ 2013-06-27 ║ 2013-06-27 ║ 2339000 ║
║ B ║ 2013-06-27 13:59 ║ 2339000 ║ ║ ║ 2013-06-27 ║ 2013-06-27 ║ 2339000 ║
║ B ║ 2013-06-27 13:59 ║ 2339000 ║ 2339000 ║ ║ 2013-06-27 ║ 2013-06-27 ║ 2339000 ║
║ C ║ 2015-02-09 12:43 ║ NULL ║ ║ ║ 2015-02-09 ║ 2015-02-09 ║ NULL ║
║ C ║ 2015-02-09 12:43 ║ NULL ║ NULL ║ ║ 2015-02-09 ║ 2015-02-09 ║ NULL ║
║ D ║ 2013-12-02 0:05 ║ NULL ║ ║ ║ 2013-12-02 ║ 2013-12-02 ║ 37000 ║
║ D ║ 2013-12-02 0:37 ║ 37000 ║ 37000 ║ ║ 2013-12-02 ║ 2013-12-02 ║ 37000 ║
║ D ║ 2014-07-16 7:36 ║ 0 ║ ║ ║ 2014-07-16 ║ 2014-07-16 ║ 0 ║
║ D ║ 2014-07-16 7:36 ║ 0 ║ 0 ║ ║ 2014-07-16 ║ 2014-07-16 ║ 0 ║
║ E ║ 2013-06-27 8:35 ║ NULL ║ NULL ║ ║ 2013-06-27 ║ 2013-06-27 ║ NULL ║
╚════╩═════════════════════════════╩═════════╩════════════════╩══╩═════════════╩════════════╩═════════╝
References:
- Column A - ID
- Column B - Timestamp
- Column F - Date Format
- Column G - Max Date
- Column H - Test
Here are the steps I tried:
- I created the Date Format using
date
- Created the Max Date with
=MAX(IF($F$2:$F$22=F2,IF($A$2:$A$22=A2,$B$2:$B$22)))
(in array) - Created Test with
=INDEX(C2:C22,MATCH(G2,B2:B22,0))
(in array)