analyse 3 columns, return date of next purchase for same client and product (Index Match)

cgrynberg

New Member
Joined
Jan 11, 2008
Messages
12
Hello Everyone,

I have 3 columns of information. Column A with Client-ID, Column B with Product_ID and Column C with Date of Purchase. In Column D, I want to, after analysing the 3 columns, have it return the first date of the next purchase, IF the same client has purchased the same product in a future date. Just to be clear, if the client has purchased the same product in multiple dates, I only need the first date. Tried Index Match but can't figure out how to make the dates work. Hopefully the table below illustrates well what I need. Many thanks.

Client_ID
Product_ID
Date_Purchase
Next Purchase
23178
GBD
27/12/2017
29/12/2017
27844KSD27/12/20170
12345DIO27/12/20170
32413DCV28/12/2017
0
57665KJS28/12/2017
0
12312EMA28/12/2017
0
43768DSL28/12/2017
0
45823POD28/12/2017
0
68893BHW28/12/2017
0
23694ENH29/12/2017
0
23178GBD29/12/2017
03/01/2018
9253RAK29/12/2017
0
32791JXD29/12/2017
0
91287XSD29/12/2017
0
45724XLK29/12/2017
0
74856IDS30/12/2017
03/01/2018
10002CVB30/12/2017
0
23178ADS30/12/2017
0
34572IND02/01/2018
0
23567ORA02/01/2018
0
78932ODB02/01/2018
0
82638POD02/01/2018
0
67283GER02/01/2018
0
27844CRG03/01/2018
0
23178GBD03/01/2018
0
74856IDS03/01/2018
0
[td]10002
[/td]
[td]MVM
[/td]
[td]27/12/2017
[/td]
[td]0

[/td]
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
Hello,

Thank for the answer, I have been busy and took me a while to get back here. Your solution is quite simple, I like it, but I was hoping to do it without the sorting, as I have this info coming in a query, and would like to do it automatically. Your idea of simply looking the next events gave me an idea though: Here is what I came up with:

In column D I have: =MIN(IF(A3:A$65536=A2,IF(B3:B$65536=B2, C3:C$65536,9999999999999),9999999999999)) as an array.
In column F I have =IF(D2=9999999999999,"",D2)

Perhaps not the most elegant, but it works without sorting. Would you have any other suggestion on how to make it better?

Mny thanks for taking the time to help out!
 
Upvote 0
Nice solution.

Prob not much better but is shorter
Try (untested)

=MIN(IF((A3:A$65536=A2)*(B3:B$65536=B2), C3:C$65536,9999999999999))
 
Upvote 0

Forum statistics

Threads
1,214,983
Messages
6,122,582
Members
449,089
Latest member
Motoracer88

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top