Number of days between entries

GoKats78

Board Regular
Joined
Aug 22, 2008
Messages
166
I have a data set in which I am looking to find the number of days between the two most recent entries based on the area in which the occurrence happened

Capture_zpsd7fb0e53.png


Example ..the number of days between the last occurrence in Area A2 and the most recent previous one ..so in this case it would be 8/28/2014 minus 7/10/2014 = 49 days
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
Maybe...

=SUMPRODUCT(LARGE((B2:B18="A2")*(A2:A18),{1;2})*{1;-1})

If you want you can substitute "A2" by a cell reference

M.
 
Upvote 0
That did exactly what I needed it to do! the data set I provided wasn't exactly what I had ..but I was able to modify the provided formula to work!

That odd thing is if there is no match I was getting a number in the 40000's! with a little IF statement that went away.
Thanks so much for you help!
 
Upvote 0
I saw that...but I don't know what the {1;2})*{1;-1}) does..or why the formula needs them!
I need to figure that out so when I need to do one of these I can figure it out!
 
Upvote 0
Take a look at Help file about the function LARGE
You see LARGE(array,k) where k is the position, i.e., 1 = Largest; 2 = 2nd_largest and so on

LARGE(.........,{1;2})
returns an array containing two values: the Largest value; and the 2nd_largest

*{1;-1) multiplies the Largest by 1 and the 2nd_largest by -1 resulting in
Largest - 2nd_largest

Hope I made myself clear

M.
 
Last edited:
Upvote 0
I was just about to ask (I worked my way through the rest)..but was not sure what the 1,-1 did..I knew what it did...just not sure why!
One again..Thanks so much!
 
Upvote 0
I was just about to ask (I worked my way through the rest)..but was not sure what the 1,-1 did..I knew what it did...just not sure why!
One again..Thanks so much!

You are welcome.

M.
ps: i edited my post above.
 
Upvote 0

Forum statistics

Threads
1,222,437
Messages
6,166,026
Members
452,008
Latest member
Customlogoflipflops

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