Perhaps it would be easier to adopt a slightly different approach. You
could use another column to establish the Quarter of each date in
C1:C500, e.g. in X1 copied down to X500
="Q"&MOD(INT((MONTH(C1)+2)/3),4)+1&TEXT(EDATE(C1,3),"-yy")
which should give you the correct quarters, e.g. 12/12/2003 gives
"Q1-04"
then use this formula in Z1
=AVERAGE(IF(X$1:X$500=Y1,D$1:D$500-C$1:C$500))
confirmed with CTRL+SHIFT+ENTER
where Y1 contains "Q1-04" or similar
Note for the first formula above that EDATE is part of Analysis ToolPak
add-in, if you can't use that try this formula instead
="Q"&MOD(INT((MONTH(C1)+2)/3),4)+1&TEXT(DATE(YEAR(C1),MONTH(C1)+3,1),"-yy")
--
daddylonglegs
------------------------------------------------------------------------
daddylonglegs's Profile:
http://www.excelforum.com/member.php...o&userid=30486
View this thread:
http://www.excelforum.com/showthread...hreadid=515284