1

I have a list of orders with the following columuns: Buyer ID, Order Date, Order Value

I need to add one column that lists the FIRST order date, and one that lists the LAST order date. In case of only 1 order, the date would be the same in both columns.

EG - this is what I have

Buyer ID   Order Date
1          1/31/2016
2          2/27/2016   
1          5/31/2016

This is what I would like

Buyer ID   Order Date   Last Order   First Order
1          1/31/2016    5/31/2016    1/31/2016
2          2/27/2016    2/27/2016    2/27/2016
1          5/31/2016    5/31/2016    1/31/2016

I have over 1000 buyer IDs, not all of them have multiple orders

1 Answer 1

1

Let's assume your "Buyer ID" values are in cells A2:A4, and your "Order Date" values are in cells B2:B4. To get the "Last" value in cell C2 (the topmost non-header cell in your "Last Order" column), type or paste the following formula, then press Ctrl+Shift+Enter to enter it:

=MAX(IF($A$2:$A$4 = A2, $B$2:$B$4))


Then, to get the "First" value in cell D2 (the topmost non-header cell in your "First Order" column), type or paste the following formula, and again press Ctrl+Shift+Enter to enter it:

=MIN(IF($A$2:$A$4 = A2, $B$2:$B$4))


Then, simply formula-copy the cells C2:D2 down to as many rows as you have data.

Please note that it is important to enter the formulas using Ctrl+Shift+Enter instead of just pressing the Enter key, as this will create an array formula. Otherwise, in each cell you would get the MAX or MIN values for the entire range A2:A4, without taking the "Buyer ID" criterion into consideration.

5
  • I only have one issue, the file now takes a very long time to open/save/edit.. Any way to make excel faster with Array Formulas?
    – Ferri.ema
    Commented Oct 20, 2016 at 22:25
  • Not that I know of. How many rows do you have exactly, and how long is the delay?
    – MJH
    Commented Oct 20, 2016 at 22:29
  • almost 3k rows, but will gradually increase every month.. The delay is probably around 5min.. with 100% cpu usage.. (i5 3570k overclocked at 4.5ghz)
    – Ferri.ema
    Commented Oct 21, 2016 at 1:55
  • I've never needed to use an array formula on a range that large, so I didn't realize the delay would be so bad. If you can save all the rows for the Buyer ID and Order Date columns as a CSV file, then upload the file (or just its text) somewhere and post a link to it, I can take a look. However, it might take me a while. The machine on which I run Excel suffered a rather bad HDD crash this morning, and I may need a few days to recover from it.
    – MJH
    Commented Oct 21, 2016 at 4:35
  • Thank you for your help MJH, however the Buyer IDs are actual customers names so I will need to ask my boss if I can discolse this info (I dont want to be in trouble :P). I will let you know! Thanks!
    – Ferri.ema
    Commented Oct 21, 2016 at 11:43

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .