View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Bernie Deitrick Bernie Deitrick is offline
external usenet poster
 
Posts: 5,441
Default Counting number of observations within a date range?

Nic,

Two things: the formula cannot produce negative numbers, and you need to take off the -1: I was
counting the number of OTHER programs open, not including the project on the current line (my bad).
Anyway, if you post your email here or contact me privately, I will send you a working example
workbook.

HTH,
Bernie
MS Excel MVP


"Nic" wrote in message
...
Thanks Bernie.

Something must be wrong, I get a lot of negative values?

"Bernie Deitrick" wrote:

Nic,

With your starting dates in column B, starting in row 2, and ending dates in column C

=SUMPRODUCT((((B2<=$C$2:$C$1000)*(C2=$C$2:$C$1000 )+(C2=$B$2:$B$1000)*(C2<=$C$2:$C$1000))0)*1)-1

HTH,
Bernie
MS Excel MVP


"Nic" wrote in message
...
Hi,

I have two columns with dates in my dataset, which define
the start and end dates for a certain event. For each
observation in the dataset, I'd like to count the
number of other observations in the dataset that
overlap with this event window.

I.e.

Event Start date End date Simultaneous events
-----------------------------------------------------------------------------------
XYZ 11jan04 07feb04 ???
ZZZ 11jan04 08feb04 ???
YYY 14jan04 22jan04 ???
XXX 21jan04 13mar04 ???
ZZY 30jan04 04feb04 ???

aso.aso.


Many thanks for your help!