# Trying to Get Median Based on Dates and Duplicate Values

#### monicamarie

##### Board Regular
Hello,

I am trying to find a formula that will produce the results below for the median. My array table is sorted by the Purchase Date from ascending to descending. I am basically trying to find the median date range based on the Purchase Date where all unique values from the Inventory Code column are included. In my example below the date range I need is from 2/6/13 to 2/19/13. I'm not quite sure how else to explain this so hopefully I am making sense. Is there a formula that will produce this result? It doesn't have to be like the example below where the result is showing in column C as "Median". I just need to somehow come up with a way to get the answer 2/6/13 to 2/19/13.
Thank you.

 1​ A​ B​ C​ 2​ Inventory Code Purchase Date Result 3​ 19933146​ 1/19/2013 4​ 36601355​ 1/28/2013 5​ 19933146​ 2/1/2013 6​ 19933146​ 2/2/2013 7​ 30012569​ 2/6/2013​ median 8​ 31258801​ 2/6/2013​ median 9​ 36601355​ 2/6/2013​ median 10​ 19933146​ 2/15/2013​ median 11​ 41677800​ 2/18/2013​ median 12​ 11250138​ 2/18/2013​ median 13​ 36601355​ 2/19/2013​ median 14​ 25141098​ 2/19/2013​ median 15​ 36601355​ 2/20/2013 16​ 36601355​ 2/26/2013 17​ 19933146​ 3/1/2013 18​ 19933146​ 3/4/2013 19​ 19933146​ 3/25/2013 20​ 36601355​ 3/28/2013

<TBODY>
</TBODY>

### Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"

Replies
10
Views
266
Replies
8
Views
195
Replies
9
Views
141
Replies
6
Views
213
Replies
1
Views
130

1,203,249
Messages
6,054,380
Members
444,721
Latest member
BAFRA77

### 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.

### Which adblocker are you using?

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

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