Hello,
I have a large customer data file that logs customer transactions and their dates (I.e buy, sell, other).
Is there to summarize the log to associate the next sell event date after a buy event date if it exists.
*Some customer numbers have sell dates prior to the buy date.
I.e. -
Original-
| Customer Number | Event Type | Event Date | Buy Date | Sell Date |
| 1234 | Sell | 1/9/2018 | 1/9/2018 | |
| 1234 | Buy | 3/5/2018 | 3/5/2018 | |
| 4567 | Other | 6/7/2018 | ||
| 4567 | Sell | 6/7/2018 | 6/7/2018 | |
| 4567 | Buy | 6/19/2018 | 6/19/2018 | |
| 4567 | Other | 6/21/2018 | ||
| 4567 | Other | 6/21/2018 | ||
| 9871 | Buy | 4/25/2018 | 4/25/2018 | |
| 9871 | Sell | 6/12/2018 | 6/12/2018 | |
| 9871 | Other | 6/20/2018 | ||
| 8523 | Other | 10/2/2018 | ||
| 8523 | Buy | 10/2/2018 | 10/2/2018 | |
| 8523 | Sell | 11/28/2018 | 11/28/2018 | |
| 7415 | Buy | 1/22/2018 | 1/22/2018 | |
| 7415 | Sell | 2/12/2018 | 2/12/2018 | |
| 7415 | Other | 2/13/2018 | ||
| 7415 | Sell | 2/14/2018 | 2/14/2018 | |
| 9635 | Buy | 3/9/2018 | 3/9/2018 | |
| 9635 | Sell | 4/11/2018 | 4/11/2018 | |
| 9635 | Other | 4/20/2018 | ||
| 8524 | Buy | 4/4/2018 | 4/4/2018 | |
| 8524 | Other | 5/3/2018 | ||
| 8524 | Other | 6/7/2018 | ||
| 8524 | Other | 9/25/2018 | ||
| 8524 | Sell | 11/26/2018 | 11/26/2018 | |
| 9999 | Buy,Sell | 6/8/2018 | 6/8/2018 | 6/8/2018 |
| 8881 | Sell | 1/18/2018 | 1/18/2018 | |
| 8881 | Sell | 2/28/2018 | 2/28/2018 | |
| 8881 | Sell | 3/16/2018 | 3/16/2018 | |
| 8881 | Sell | 4/10/2018 | 4/10/2018 | |
| 8881 | Sell | 4/30/2018 | 4/30/2018 | |
| 8881 | Sell | 5/16/2018 | 5/16/2018 | |
| 8881 | Other | 5/16/2018 | ||
| 8881 | Sell | 5/29/2018 | 5/29/2018 | |
| 8881 | Sell | 6/27/2018 | 6/27/2018 | |
| 8881 | Other | 7/9/2018 | ||
| 8881 | Buy | 8/2/2018 | 8/2/2018 | |
| 8881 | Sell | 8/20/2018 | 8/20/2018 | |
| 8881 | Sell | 9/7/2018 | 9/7/2018 | |
| 8881 | Sell | 9/24/2018 | 9/24/2018 | |
| 8881 | Sell | 10/5/2018 | 10/5/2018 | |
| 8881 | Buy,Sell | 11/6/2018 | 11/6/2018 | 11/6/2018 |
| 8881 | Sell | 12/13/2018 | 12/13/2018 |
Desired outcome-
| Customer Number | Event Type | Event Date | Buy Date | Sell Date |
| 9871 | Buy | 4/25/2018 | 4/25/2018 | 6/12/2018 |
| 8523 | Buy | 10/2/2018 | 10/2/2018 | 11/28/2018 |
| 7415 | Buy | 1/22/2018 | 1/22/2018 | 2/12/2018 |
| 9635 | Buy | 3/9/2018 | 3/9/2018 | 4/11/2018 |
| 8524 | Buy | 4/4/2018 | 4/4/2018 | 11/26/2018 |
| 9999 | Buy,Sell | 6/8/2018 | 6/8/2018 | 6/8/2018 |
| 8881 | Buy | 8/2/2018 | 8/2/2018 | 8/20/2018 |
| 8881 | Buy,Sell | 11/6/2018 | 11/6/2018 | 11/6/2018 |
Solved! Go to Solution.
This is perfect!
Thank you!
-Alex
