Help with formula

Noxqss38242

Board Regular
Joined
Sep 15, 2017
Messages
223
Office Version
  1. 2016
I'm trying to find days elapsed based on dates but the dates are not chronological.
I tried putting in a helper column by using "rank" function.
Then tried to say if rank is greater than 1, index/match to pull the date and subtract current rank from previous rank's date but it errors out....

Qualifications.xlsx
CDE
317/12/20231 
32
334/20/20224#VALUE!
34
352/12/20233
36
371/8/20187
38
392/20/20225
40 
411/20/20226
42
437/10/20232
Sheet1
Cell Formulas
RangeFormula
D31,D43,D41,D39,D37,D35,D33D31=IF(ISBLANK(C31),"",RANK(C31,($C$31:$C$72),0))
E31,E33E31=IF(D31>1,INDEX($C$31:$C$72,MATCH(D31,$D$31:$D$72,0)-INDEX($C$31:$C$72,MATCH(D31-1,$D$31:$D$72,0))),"")
E40E40=IF(ISBLANK(C40),"",(ABS(C40-C38)))
Cells with Conditional Formatting
CellConditionCell FormatStop If True
A31:AF72Expression=MOD(ROW(),2)=0textNO
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
Like this?
Book1
AB
17/12/2023
2
34/20/2022448
4
52/12/2023298
6
71/8/20181861
8
92/20/20221504
10
111/20/202231
12
137/10/2023536
Sheet1
Cell Formulas
RangeFormula
B3,B13,B11,B9,B7,B5B3=IF(A1>A3, A1-A3,A3-A1)
 
Upvote 0
No, if put in chronological order, there would be 1473 days between 1/8/2018 and 1/20/2022 which would be in chronological order. Then 31 days between the next set of 1/20/2022 and 2/20/2022, and so on...

1/8/2018​
1/20/2022​
1473​
2/20/2022​
31​
4/20/2022​
59​
2/12/2023​
298​
7/10/2023​
148​
7/12/2023​
2​

But I need it to calculate automatically without rearranging the dates....was hoping adding a helper column might help.
 
Upvote 0
Yeah. Take a closer look at my example. They are not in chronological order and the proper count of days is correct. 448 days between 7/12/2023 and 4/20/2022. 298 days between 4/20/2022 and 2/12/2023...and so on. I'm not sure if I'm understanding correctly.
 
Upvote 0
Yeah. Take a closer look at my example. They are not in chronological order and the proper count of days is correct. 448 days between 7/12/2023 and 4/20/2022. 298 days between 4/20/2022 and 2/12/2023...and so on. I'm not sure if I'm understanding correctly.
Ahhhh. I see what you are saying @Noxqss38242 . Stand by.
 
Upvote 0
Book1
AB
11/20/2022
21/8/20181473
31/6/19987307
43/4/202610284
52/1/20163684
Sheet1
Cell Formulas
RangeFormula
B2:B5B2=ABS(DAYS(A1,A2))
 
Upvote 0
I'm needing it to calculate like IF it was in chronological order.

It is for accidents that occurred and finding out how many days since the last accident but the data is entered radomly.

So, the formula needs to be able to tell, what is the oldest date and the elapsed time it took since the next chronological next date.

The "answers" to the math is what I posted in post # 3 but I had to put them in chronological order to get that, I need a formula that I don't have to sort the data first which is why I thought I needed to have a helper column. In my original post, #1 is the newest date and #7 is the oldest date. So I need a formula that maybe says for it to search the helper column for 7, grab the date next to it, then look for 6 and minus the date that matches for 6.

My first example I had the formula (that doesn't work) All the way to 1, search 1 date and minus 2 date, 2 date minus 3 date, 3 date minus 4 date, so on and so forth....since the helper column says what order they are chronologically.

I hope I'm not confusing it more....
 
Upvote 0
I'm needing it to calculate like IF it was in chronological order.

It is for accidents that occurred and finding out how many days since the last accident but the data is entered radomly.

So, the formula needs to be able to tell, what is the oldest date and the elapsed time it took since the next chronological next date.

The "answers" to the math is what I posted in post # 3 but I had to put them in chronological order to get that, I need a formula that I don't have to sort the data first which is why I thought I needed to have a helper column. In my original post, #1 is the newest date and #7 is the oldest date. So I need a formula that maybe says for it to search the helper column for 7, grab the date next to it, then look for 6 and minus the date that matches for 6.

My first example I had the formula (that doesn't work) All the way to 1, search 1 date and minus 2 date, 2 date minus 3 date, 3 date minus 4 date, so on and so forth....since the helper column says what order they are chronologically.

I hope I'm not confusing it more....
Did you try post #6?
 
Upvote 0
With that formula, it shows:
1692320442767.png


I put that formula in but it doesn't work the way it should because it should be:

1692320607124.png


Since it was only 150 days between 7/12/2023 and the next chronological date of 2/12/2023 and so on...
 
Upvote 0
Since it was only 150 days between 7/12/2023 and the next chronological date of 2/12/2023 and so on...
Chronologically, 7/12/2023 is after 2/12/2023. And, if you're sorting "chronologically", then use Sort and include extra data.
1692321412808.png
 
Upvote 0

Forum statistics

Threads
1,215,084
Messages
6,123,024
Members
449,092
Latest member
ikke

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