date Subtraction with serial numbers as a reference

queysoft

New Member
Joined
Aug 3, 2021
Messages
49
Office Version
  1. 2016
Platform
  1. Windows
Hello - Stuck with this one - I'm sure its simple and i am once again overthinking......

So, Column A = List of serial numbers (some unique, some duplicated several times) - ALL IN ORDER.
Column B = Date

What I want, is a formula that subtracts the LAST date from the FIRST date for each serial number to get a max number of days for each serial number.

The sheet is sorted by serial and then by date descending.

So the formula would look at the serials, and pick out the last and first date for each serial number. For the unique serials of course the return would be a zero.

Any ideas?
 

Attachments

  • Screenshot_example_0812.jpg
    Screenshot_example_0812.jpg
    109.2 KB · Views: 13

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
How about
Excel Formula:
=IF(COUNTIFS(A$2:A2,A2)=1, AGGREGATE(14,6,$B$2:$B$100/($A$2:$A$100=A2),1)-B2,"")
 
Upvote 0
Solution
you are showing 2016 version in profile
so a MINIFS and a MAXIFS maybe the way to go by ID number

As its an image i cannot test - so may setup if i have time or use XL2BB to post a sample - see signature / menu
 
Upvote 0
@etaf both minifs & maxifs are only available with 2019 or newer.
 
Upvote 0
Thanks @Fluff, I thought 2016 version had them as i searched google to see
Cant trust the internet :) :) :) (where have i heard that before) :) :) :)
 
Upvote 0
Good work chaps! The first solution works a treat…..Correct also about MAXIFS not working. Work won’t shell out for O365 nor upgrade me, yet I’m asked to do stuff like this. Plus of course GDPR prevents me using my personal laptop. Hey ho.
 
Upvote 0
Also why it was just a screen shot and not the sheet (download permissions etc to install what’s needed)
 
Upvote 0
Glad we could help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,214,376
Messages
6,119,179
Members
448,871
Latest member
hengshankouniuniu

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