Calculate interval between dates based on input at another columns

nburaq

Board Regular
Joined
Apr 2, 2021
Messages
220
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
Hi,

I would like to try to find interval between two dates based on the material number. I figured out difference between dates in terms of dates with this formula =DATEDIF(MIN(B2:B17);MAX(B2:B17);"d") but could not manage it to combine with filter.(or any other formula that will help to solve this) here is the simple date:

MatdateInterval (days)
123456
16/03/2018​
123456
26/04/2018​
123456
09/05/2018​
123456
14/06/2018​
123456
15/06/2018​
888888
06/08/2018​
123456
27/08/2018​
123456
26/03/2019​
999999
24/03/2020​
123456
24/03/2020​
123456
25/03/2020​
123456
16/11/2020​
123456
07/12/2020​
123456
07/12/2020​
123456
07/12/2020​
123456
07/12/2020​

so basically result of mat 123456 in column interval will be seen as 997 days and if there is no repeating material, then reference date will be 25/02/2024. In this case for mat 888888 will be 2029 days.

Thanks for your help!
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
Solved myself , by adding d1 25/02/2024 as static value and formula is :
=IF(COUNTIF($A$2:$A$17;$A2)<=1;$D$1-MINIFS($B$2:$B$17;$A$2:$A$17;$A2);MAXIFS($B$2:$B$17;$A$2:$A$17;$A2)-MINIFS($B$2:$B$17;$A$2:$A$17;$A2))

Thanks again
 
Upvote 0
Solution
Here is a short formula, i'm sure there are others:

Do you want big negative numbers in Rows 8 and 11?
Look at formula in column C.

Book1
ABCD
1MatdateInterval (days)Your Formula
2
31234562018-03-16997997
41234562018-04-26997997
51234562018-05-09997997
61234562018-06-14997997
71234562018-06-15997997
88888882018-08-060-43318
91234562018-08-27997997
101234562019-03-26997997
119999992020-03-240-43914
121234562020-03-24997997
131234562020-03-25997997
141234562020-11-16997997
151234562020-12-07997997
161234562020-12-07997997
171234562020-12-07997997
181234562020-12-07997997
Sheet2
Cell Formulas
RangeFormula
C3:C18C3=MAXIFS($B$3:$B$18,$A$3:$A$18,A3)-MINIFS($B$3:$B$18,$A$3:$A$18,A3)
D3:D18D3=IF( COUNTIF($A$3:$A$18,$A3)<=1, $D$2-MINIFS($B$3:$B$18,$A$3:$A$18,$A3), MAXIFS($B$3:$B$18,$A$3:$A$18,$A3)-MINIFS($B$3:$B$18,$A$3:$A$18,$A3))
 
Upvote 0

Forum statistics

Threads
1,215,069
Messages
6,122,959
Members
449,096
Latest member
Anshu121

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