View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
smartin smartin is offline
external usenet poster
 
Posts: 915
Default Help need formula for working out date overlaps

smartin wrote:
Herbert Seidenberg wrote:
Try
1/1/2008 20/11/2008
9/11/2008 11/11/2008


Ah, a misplaced paren:

=MAX(0,MIN(KeyDateEnd,$B1)+1-MAX(KeyDateStart,$A1))+1
^^^


If anyone is still looking at this, I wonder if there is an array
solution that will do it? I think such a solution could have much wider
applications that touch on set operations.

E.g., In general, given two series of discreet values, denoted by their
respective endpoints,

series A: a...b
and
series B: c...d

1) Determine how many values are common to A and B, or
2) (better) Enumerate the values common to A and B so they can be
counted, summed, etc.
3) (going a step further) Enumerate the non-intersect values of A and B

Anyone up for a challenge? I know I am--and I dabbled at this, but my
grasp of handling arrays is feeble at best.