Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3
Default Counting a range to see if it encompasses a given date

Hi,

Ive been looking all over for a solution for this.

I basically want to count the amount of times a date falls between 2 dates.
The problem is that my start & end date are in different columns of a row and
I have 100's of Rows that have the start and end date

Example of data:

Column 1 Column 2
Row1 10/8/2007 10/11/2007
Row2 10/9/2007 10/12/2007

So in this example I want to count how many times 10/10/2007 will fall on or
between the dates in column1 & column2.

The correct answer would be 2 in this case.

Hope someone can help as im doing my head in with this one.

BR.....Q

  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Max Max is offline
external usenet poster
 
Posts: 9,221
Default Counting a range to see if it encompasses a given date

In C1:
=SUMPRODUCT((A1:A10<=--"10-Oct-2007")*(B1:B10=--"10-Oct-2007"))
where A1:A10 = start dates, B1:B10 = end dates
--
Max
Singapore
http://savefile.com/projects/236895
xdemechanik
---
"Quovardis" <u38145@uwe wrote in message news:7981a2847c766@uwe...
Hi,

Ive been looking all over for a solution for this.

I basically want to count the amount of times a date falls between 2
dates.
The problem is that my start & end date are in different columns of a row
and
I have 100's of Rows that have the start and end date

Example of data:

Column 1 Column 2
Row1 10/8/2007 10/11/2007
Row2 10/9/2007 10/12/2007

So in this example I want to count how many times 10/10/2007 will fall on
or
between the dates in column1 & column2.

The correct answer would be 2 in this case.

Hope someone can help as im doing my head in with this one.

BR.....Q



  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3
Default Counting a range to see if it encompasses a given date

Hi Max,

Thanks for the swift reply but unfortunately it doesnt work

9/27/2007 10/5/2007
9/28/2007 10/5/2007
9/26/2007 10/5/2007
9/29/2007 10/5/2007
9/28/2007 10/5/2007
10/3/2007 10/5/2007
10/3/2007 10/5/2007

Basically in my sheet I have here,if im looking for how many times 10/1/2007
will be in the range then it would return 5 as correct answer.

Your formulae for some reason doesnt return this

Max wrote:
In C1:
=SUMPRODUCT((A1:A10<=--"10-Oct-2007")*(B1:B10=--"10-Oct-2007"))
where A1:A10 = start dates, B1:B10 = end dates
Hi,

[quoted text clipped - 21 lines]

BR.....Q


  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 15,768
Default Counting a range to see if it encompasses a given date

Try this:

D1 = 10/1/2007

=SUMPRODUCT(--(D1=A1:A7),--(D1<=B1:B7))

--
Biff
Microsoft Excel MVP


"Quovardis" <u38145@uwe wrote in message news:7981a2847c766@uwe...
Hi,

Ive been looking all over for a solution for this.

I basically want to count the amount of times a date falls between 2
dates.
The problem is that my start & end date are in different columns of a row
and
I have 100's of Rows that have the start and end date

Example of data:

Column 1 Column 2
Row1 10/8/2007 10/11/2007
Row2 10/9/2007 10/12/2007

So in this example I want to count how many times 10/10/2007 will fall on
or
between the dates in column1 & column2.

The correct answer would be 2 in this case.

Hope someone can help as im doing my head in with this one.

BR.....Q



  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Max Max is offline
external usenet poster
 
Posts: 9,221
Default Counting a range to see if it encompasses a given date

It should work fine. Just re-tested it here.

Did you **adjust** the date to be compared in the suggested formula from:
10th Oct 2007 (as per your original post) to 1st Oct 2007 (in your latest
response below), ie did you use:

=SUMPRODUCT((A1:A10<=--"1-Oct-2007")*(B1:B10=--"1-Oct-2007"))

If the above still doesn't work, that means your source dates data in cols A
and B are not real dates. You can use Data Text to Columns to convert each
col in turn to real dates. Just select say, col A, click Data Text to
Columns. Click Next Next. In step 3, select Date, then choose from the
droplist: MDY, click Finish. Repeat for col B.
--
Max
Singapore
http://savefile.com/projects/236895
xdemechanik
---
"Quovardis" <u38145@uwe wrote in message news:7981e346487a7@uwe...
Hi Max,

Thanks for the swift reply but unfortunately it doesnt work

9/27/2007 10/5/2007
9/28/2007 10/5/2007
9/26/2007 10/5/2007
9/29/2007 10/5/2007
9/28/2007 10/5/2007
10/3/2007 10/5/2007
10/3/2007 10/5/2007

Basically in my sheet I have here,if im looking for how many times
10/1/2007
will be in the range then it would return 5 as correct answer.

Your formulae for some reason doesnt return this





  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3
Default Counting a range to see if it encompasses a given date

Okay Guys,

Thanks for the help.....it seems to be working....getting some really weird
numbers back so I will double check but its nothing wrong with the formulae.

Thanks again.

T. Valko wrote:
Try this:

D1 = 10/1/2007

=SUMPRODUCT(--(D1=A1:A7),--(D1<=B1:B7))

Hi,

[quoted text clipped - 21 lines]

BR.....Q


  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Max Max is offline
external usenet poster
 
Posts: 9,221
Default Counting a range to see if it encompasses a given date

getting some really weird numbers back so I will double check ..

You probably have a mixture of real and text dates in the source cols. As
responsed to you in the other branch, use Data Text to Columns to convert
it all at one go (per source col) to real dates
--
Max
Singapore
http://savefile.com/projects/236895
xdemechanik
---
"Quovardis" <u38145@uwe wrote in message news:79830839af4c6@uwe...
Okay Guys,

Thanks for the help.....it seems to be working....getting some really
weird
numbers back so I will double check but its nothing wrong with the
formulae.

Thanks again.



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Counting Unique Values by Date Range [email protected] Excel Worksheet Functions 5 August 2nd 07 09:36 PM
Counting number of observations within a date range? Nic Excel Worksheet Functions 7 April 20th 07 09:20 AM
Counting if between date range Marc Shaw Excel Worksheet Functions 7 September 25th 06 07:26 PM
Counting unique records based on date range aspAddict Excel Worksheet Functions 3 October 26th 05 08:12 PM
Counting values within a Date Range Jana Excel Discussion (Misc queries) 7 December 9th 04 10:18 PM


All times are GMT +1. The time now is 07:40 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"