View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
daddylonglegs
 
Posts: n/a
Default return based on range of dates


Matt Wrote:
Wierd. After playing around, that formula works for February - December
but
isn't for January. Thank you though. I am REALLY close now


In Excel a blank cell - in date terms - is a date in January 1900 so
=MONTH(A1), when A1 is blank gives 1, i.e. January, hence your
problems. There are several other approaches which would eliminate this
problem, one is

=COUNTIF('SalesPerson'!A2:A500,"="&DATE(2006,1,1) )-COUNTIF('SalesPerson'!A2:A500,""&DATE(2006,1,31))

or for a more generic approach put the 1st day of the month you
require, e.g. 01/01/2006 in a cell, e.g. H2 and use

=COUNTIF('SalesPerson'!A2:A500,"="&H2)-COUNTIF('SalesPerson'!A2:A500,""&EOMONTH(H2,0))

Note:EOMONTH requires Analysis ToolPak


--
daddylonglegs
------------------------------------------------------------------------
daddylonglegs's Profile: http://www.excelforum.com/member.php...o&userid=30486
View this thread: http://www.excelforum.com/showthread...hreadid=511912