looking age of last non-matching value

I have data that looks like this (three columns: Date, IGN and AP):

 

Date IGN AP
8/8/2019 Emxmari0 3560
8/11/2019 Emxmari0 3580
8/12/2019 Emxmari0 3580
8/16/2019 Emxmari0 3590
8/17/2019 Emxmari0 3590
8/21/2019 Emxmari0 3590
8/22/2019 Emxmari0 3590
8/23/2019 Emxmari0 3590
8/24/2019 Emxmari0 3590
8/28/2019 Emxmari0 3590
8/31/2019 Emxmari0 3590

 

I would like to create a new column AGE that when looking up the last value for the IGN column (just showing Emxmari0 in this case) I would like to look up the AP (3590) for last row of the given IGN (the 8/31/2019 date) and then look backwards in time to find the row for the given IGN with a different value in the AP column (the 8/12/2019 date vas a value of 3580), then with the two rows identified give the difference in days using the A column, 19 in this case.  If a row for a given IGN isn’t the last row (which presumes the highest date) then the value for AGE would be blank.

Any help toward figuring this out would be appreciated!

By: Joel Breazeale

656 thoughts on “looking age of last non-matching value

  1. DMV African

    Excellent read, I just passed this onto a friend who was doing some research on that. And he just bought me lunch because I found it for him smile So let me rephrase that: Thank you for lunch!

  2. Australian Office Furniture Buy

    Thank you for the sensible critique. Me & my neighbor were just preparing to do a little research on this. We got a grab a book from our area library but I think I learned more from this post. I’m very glad to see such excellent information being shared freely out there.

Leave a Reply

Your email address will not be published. Required fields are marked *