Date difference Average

kashyap

Board Regular
Joined
Mar 28, 2009
Messages
173
I have 2 column as below and I want to calculate the average number of days
ABC occurs.. In this case it should be 3.33

Col A Col B
01-Apr ABC
01-Apr DBA
01-Apr ABC
03-Apr GRT
05-Apr HTA
05-Apr JYU
08-Apr ABC
08-Apr GRT
08-Apr HTA
10-Apr JYU
11-Apr ABC
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
=countif(b1:b11,"abc")/counta(b1:b11)

And the result is 0.3636...infinity to be exact.


EDIT: Who edits my formulas from Upper case to lower case?
 
Upvote 0
Assuming that A2:B12 contains the data, try the following formula that needs to be confirmed with CONTROL+SHIFT+ENTER...

=AVERAGE(SMALL(IF(B2:B12="ABC",A2:A12),ROW(INDIRECT("2:"&COUNTIF(B2:B12,"ABC"))))-SMALL(IF(B2:B12="ABC",A2:A12),ROW(INDIRECT("1:"&COUNTIF(B2:B12,"ABC")-1))))
 
Upvote 0
EDIT: Who edits my formulas from Upper case to lower case?

The board software does that. It's trying to prevent someone from writing in all CAPS, which is against the forum policy. It's easy to get around, just write something else BEFORE then formula, like

Try this

FORMULA HERE..
 
Upvote 0
Hi Domenic.. This is the output I got..

01-Apr ABC 0
01-Apr DBA #NUM!
01-Apr ABC 2
03-Apr GRT #NUM!
05-Apr HTA #NUM!
05-Apr JYU #NUM!
08-Apr ABC 0
08-Apr GRT #REF!
08-Apr HTA #REF!
10-Apr JYU #REF!
11-Apr ABC #REF!
 
Upvote 0

Forum statistics

Threads
1,223,240
Messages
6,170,951
Members
452,368
Latest member
jayp2104

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