#1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 9
Default Date query

Hi,

What is the simplest way to check 5 different dates to see if they lie
within 4 seperate date ranges(Yearly quarters) and count the number of days
attributable to each quarter?

eg
Q1 Jan 1 - Mar 31
Q2 Apr 1 - Jun 30
Q3 Jul 1 - Sep 30
Q4 Oct 1 - Dec 31

Voyage: 24 Mar, 25 Mar, 4 Apr, 5 Apr & 14 Apr

This voyage to place 7 days in Q1 (24 Mar to 31 Mar)
& 14 Days in Q2 (1 Apr to 14 Apr)

I need to check around 200 voyages at a time.

Is there an easy way?


--
Many Thanks,
CK
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 10,593
Default Date query

=SUMPRODUCT(--(INT((MONTH(ROW(INDIRECT(A1&":"&B1)))+2)/3)=1))

=SUMPRODUCT(--(INT((MONTH(ROW(INDIRECT(A1&":"&B1)))+2)/3)=2))

etc.

--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)



"Crimson King" wrote in message
...
Hi,

What is the simplest way to check 5 different dates to see if they lie
within 4 seperate date ranges(Yearly quarters) and count the number of
days
attributable to each quarter?

eg
Q1 Jan 1 - Mar 31
Q2 Apr 1 - Jun 30
Q3 Jul 1 - Sep 30
Q4 Oct 1 - Dec 31

Voyage: 24 Mar, 25 Mar, 4 Apr, 5 Apr & 14 Apr

This voyage to place 7 days in Q1 (24 Mar to 31 Mar)
& 14 Days in Q2 (1 Apr to 14 Apr)

I need to check around 200 voyages at a time.

Is there an easy way?


--
Many Thanks,
CK



  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 9
Default Date query

Bob,

Excellent! Your formula has solved 97% of my problem. Thank You.
The only issue I have remaining is how to ignore dates that are outside the
current year.

I was considering nesting an IF statement around your formula but am unsure
how best to do this. Any thoughts?



--
Many Thanks,
CK


"Bob Phillips" wrote:

=SUMPRODUCT(--(INT((MONTH(ROW(INDIRECT(A1&":"&B1)))+2)/3)=1))

=SUMPRODUCT(--(INT((MONTH(ROW(INDIRECT(A1&":"&B1)))+2)/3)=2))

etc.

--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)



"Crimson King" wrote in message
...
Hi,

What is the simplest way to check 5 different dates to see if they lie
within 4 seperate date ranges(Yearly quarters) and count the number of
days
attributable to each quarter?

eg
Q1 Jan 1 - Mar 31
Q2 Apr 1 - Jun 30
Q3 Jul 1 - Sep 30
Q4 Oct 1 - Dec 31

Voyage: 24 Mar, 25 Mar, 4 Apr, 5 Apr & 14 Apr

This voyage to place 7 days in Q1 (24 Mar to 31 Mar)
& 14 Days in Q2 (1 Apr to 14 Apr)

I need to check around 200 voyages at a time.

Is there an easy way?


--
Many Thanks,
CK




  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 10,593
Default Date query

CK,

You need to add to the SP formula

=SUMPRODUCT(--(INT((MONTH(ROW(INDIRECT(A1&":"&B1)))+2)/3)=1),--(YEAR(ROW(INDIRECT(A1&":"&B1)))=YEAR(TODAY())))

--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)



"Crimson King" wrote in message
...
Bob,

Excellent! Your formula has solved 97% of my problem. Thank You.
The only issue I have remaining is how to ignore dates that are outside
the
current year.

I was considering nesting an IF statement around your formula but am
unsure
how best to do this. Any thoughts?



--
Many Thanks,
CK


"Bob Phillips" wrote:

=SUMPRODUCT(--(INT((MONTH(ROW(INDIRECT(A1&":"&B1)))+2)/3)=1))

=SUMPRODUCT(--(INT((MONTH(ROW(INDIRECT(A1&":"&B1)))+2)/3)=2))

etc.

--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my
addy)



"Crimson King" wrote in message
...
Hi,

What is the simplest way to check 5 different dates to see if they lie
within 4 seperate date ranges(Yearly quarters) and count the number of
days
attributable to each quarter?

eg
Q1 Jan 1 - Mar 31
Q2 Apr 1 - Jun 30
Q3 Jul 1 - Sep 30
Q4 Oct 1 - Dec 31

Voyage: 24 Mar, 25 Mar, 4 Apr, 5 Apr & 14 Apr

This voyage to place 7 days in Q1 (24 Mar to 31 Mar)
& 14 Days in Q2 (1 Apr to 14 Apr)

I need to check around 200 voyages at a time.

Is there an easy way?


--
Many Thanks,
CK






  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 9
Default Date query

Bab,

This is exactly what I needed. Perfect!

--
Many Thanks,
CK


"Bob Phillips" wrote:

CK,

You need to add to the SP formula

=SUMPRODUCT(--(INT((MONTH(ROW(INDIRECT(A1&":"&B1)))+2)/3)=1),--(YEAR(ROW(INDIRECT(A1&":"&B1)))=YEAR(TODAY())))

--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)



"Crimson King" wrote in message
...
Bob,

Excellent! Your formula has solved 97% of my problem. Thank You.
The only issue I have remaining is how to ignore dates that are outside
the
current year.

I was considering nesting an IF statement around your formula but am
unsure
how best to do this. Any thoughts?



--
Many Thanks,
CK


"Bob Phillips" wrote:

=SUMPRODUCT(--(INT((MONTH(ROW(INDIRECT(A1&":"&B1)))+2)/3)=1))

=SUMPRODUCT(--(INT((MONTH(ROW(INDIRECT(A1&":"&B1)))+2)/3)=2))

etc.

--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my
addy)



"Crimson King" wrote in message
...
Hi,

What is the simplest way to check 5 different dates to see if they lie
within 4 seperate date ranges(Yearly quarters) and count the number of
days
attributable to each quarter?

eg
Q1 Jan 1 - Mar 31
Q2 Apr 1 - Jun 30
Q3 Jul 1 - Sep 30
Q4 Oct 1 - Dec 31

Voyage: 24 Mar, 25 Mar, 4 Apr, 5 Apr & 14 Apr

This voyage to place 7 days in Q1 (24 Mar to 31 Mar)
& 14 Days in Q2 (1 Apr to 14 Apr)

I need to check around 200 voyages at a time.

Is there an easy way?


--
Many Thanks,
CK






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
Date Query Treza Blu Excel Discussion (Misc queries) 4 May 31st 07 09:11 PM
Query Latest Date Mack Neff Excel Discussion (Misc queries) 1 April 26th 07 07:42 PM
Date query? Harley Excel Discussion (Misc queries) 2 May 11th 06 11:31 AM
How do I query a future date? Ralph 47 Excel Worksheet Functions 0 January 31st 06 06:25 PM
How do I enter a date range ie -7 from current date in MS QUERY notsmartenough Excel Discussion (Misc queries) 1 November 11th 05 10:17 PM


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

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

About Us

"It's about Microsoft Excel"