Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 37
Default Help with a date formula

Hi there,

I am having problems finding a solution to a problem I have been given. I
have a workbook which on one sheet we log:

Job No Weekly $ Start Date End Date No of days

This information is filtered through to a monthly sheet where I filter by
job number. My problem is that I know the total number of days our equipment
has been hired for which is fine if they hire something for just one billing
month or part of that month BUT we run our invoicing from 21st month to 20th
of the next month.

So if we are charging for June this would be from 21/6/09 - 20/7/09. So if
the Start date is 21/6/09 but end date is 5/5/09 - how can I ask Excel to
work out just the number of days on hire for the June billing period?
Bearing in mind that the dates could also be say 21/6/09 - 29/6/09. I hope
this makes sense!

Any ideas on how I can ask Excel to work out based on the Month - how many
days a piece of equipment has been hired for?

Any ideas would be appreciated.


  #2   Report Post  
Posted to microsoft.public.excel.misc
Max Max is offline
external usenet poster
 
Posts: 9,221
Default Help with a date formula

Think you could try using DATE

Assuming startdates in C2 down, enddates in D2 down
(where the startdates are always the 21st of the month?)

Then in E2, E2 formatted as general/number, then copied down:
=IF(D2DATE(YEAR(C2),MONTH(C2)+1,DAY(C2)-1),DATE(YEAR(C2),MONTH(C2)+1,DAY(C2)-1)-C2+1,D2-C2+1)

Test it out and satisfy yourself that it's returning correctly
--
Max
Singapore
http://savefile.com/projects/236895
Downloads:27,000 Files:200 Subscribers:70
xdemechanik
---
"Mustang" wrote:
I am having problems finding a solution to a problem I have been given. I
have a workbook which on one sheet we log:

Job No Weekly $ Start Date End Date No of days

This information is filtered through to a monthly sheet where I filter by
job number. My problem is that I know the total number of days our equipment
has been hired for which is fine if they hire something for just one billing
month or part of that month BUT we run our invoicing from 21st month to 20th
of the next month.

So if we are charging for June this would be from 21/6/09 - 20/7/09. So if
the Start date is 21/6/09 but end date is 5/5/09 - how can I ask Excel to
work out just the number of days on hire for the June billing period?
Bearing in mind that the dates could also be say 21/6/09 - 29/6/09. I hope
this makes sense!

Any ideas on how I can ask Excel to work out based on the Month - how many
days a piece of equipment has been hired for?

Any ideas would be appreciated.


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8,520
Default Help with a date formula

With start date in C2 and end date in D2 try the below formula which will
give the number of days for the billing period of (start date month)..

=(IF(D2DATE(YEAR(D2),MONTH(C2)+1,20),DATE(YEAR(D2 ),MONTH(C2)+1,20),D2))-(IF(C2<DATE(YEAR(C2),MONTH(C2),21),DATE(YEAR(C2),M ONTH(C2),21),C2))+1

If this post helps click Yes
---------------
Jacob Skaria


"Mustang" wrote:

Hi there,

I am having problems finding a solution to a problem I have been given. I
have a workbook which on one sheet we log:

Job No Weekly $ Start Date End Date No of days

This information is filtered through to a monthly sheet where I filter by
job number. My problem is that I know the total number of days our equipment
has been hired for which is fine if they hire something for just one billing
month or part of that month BUT we run our invoicing from 21st month to 20th
of the next month.

So if we are charging for June this would be from 21/6/09 - 20/7/09. So if
the Start date is 21/6/09 but end date is 5/5/09 - how can I ask Excel to
work out just the number of days on hire for the June billing period?
Bearing in mind that the dates could also be say 21/6/09 - 29/6/09. I hope
this makes sense!

Any ideas on how I can ask Excel to work out based on the Month - how many
days a piece of equipment has been hired for?

Any ideas would be appreciated.


  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5,651
Default Help with a date formula

On Mon, 29 Jun 2009 21:23:01 -0700, Mustang
wrote:

Hi there,

I am having problems finding a solution to a problem I have been given. I
have a workbook which on one sheet we log:

Job No Weekly $ Start Date End Date No of days

This information is filtered through to a monthly sheet where I filter by
job number. My problem is that I know the total number of days our equipment
has been hired for which is fine if they hire something for just one billing
month or part of that month BUT we run our invoicing from 21st month to 20th
of the next month.

So if we are charging for June this would be from 21/6/09 - 20/7/09. So if
the Start date is 21/6/09 but end date is 5/5/09 - how can I ask Excel to
work out just the number of days on hire for the June billing period?
Bearing in mind that the dates could also be say 21/6/09 - 29/6/09. I hope
this makes sense!

Any ideas on how I can ask Excel to work out based on the Month - how many
days a piece of equipment has been hired for?

Any ideas would be appreciated.


In general, you can use this formula:

=SUMPRODUCT(--(MONTH(ROW(INDIRECT(Start_Date&":"&End_Date)))=Mon thNumber))


So for June:

=SUMPRODUCT(--(MONTH(ROW(INDIRECT(Start_Date&":"&End_Date)))=6))



Note that for versions of Excel prior to 2007, you may run into the

"dreaded 4 Jun 2079" problem

after which this formula will no longer work :-))

--ron
  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 37
Default Help with a date formula

Thank you Max,

I have tried this and tested it against a date range of 21/5/09 - 29/08/09
and I get the answer of 31.

The missing part for me is where I can tell Excel which billing month I am
in, so if I am billing for August I am looking for the answer of 9 days.

Thanks




"Max" wrote:

Think you could try using DATE

Assuming startdates in C2 down, enddates in D2 down
(where the startdates are always the 21st of the month?)

Then in E2, E2 formatted as general/number, then copied down:
=IF(D2DATE(YEAR(C2),MONTH(C2)+1,DAY(C2)-1),DATE(YEAR(C2),MONTH(C2)+1,DAY(C2)-1)-C2+1,D2-C2+1)

Test it out and satisfy yourself that it's returning correctly
--
Max
Singapore
http://savefile.com/projects/236895
Downloads:27,000 Files:200 Subscribers:70
xdemechanik
---
"Mustang" wrote:
I am having problems finding a solution to a problem I have been given. I
have a workbook which on one sheet we log:

Job No Weekly $ Start Date End Date No of days

This information is filtered through to a monthly sheet where I filter by
job number. My problem is that I know the total number of days our equipment
has been hired for which is fine if they hire something for just one billing
month or part of that month BUT we run our invoicing from 21st month to 20th
of the next month.

So if we are charging for June this would be from 21/6/09 - 20/7/09. So if
the Start date is 21/6/09 but end date is 5/5/09 - how can I ask Excel to
work out just the number of days on hire for the June billing period?
Bearing in mind that the dates could also be say 21/6/09 - 29/6/09. I hope
this makes sense!

Any ideas on how I can ask Excel to work out based on the Month - how many
days a piece of equipment has been hired for?

Any ideas would be appreciated.




  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 37
Default Help with a date formula

Thank you Jacob

I have tried this and tested this also against a date range of 21/5/09 -
29/08/09 and I get the answer of 31 (as per Max's formula).

The missing part for me is where I can tell Excel which billing month I am
in, so if I am billing for August I am looking for the answer of 9 days.

Thanks

"Jacob Skaria" wrote:

With start date in C2 and end date in D2 try the below formula which will
give the number of days for the billing period of (start date month)..

=(IF(D2DATE(YEAR(D2),MONTH(C2)+1,20),DATE(YEAR(D2 ),MONTH(C2)+1,20),D2))-(IF(C2<DATE(YEAR(C2),MONTH(C2),21),DATE(YEAR(C2),M ONTH(C2),21),C2))+1

If this post helps click Yes
---------------
Jacob Skaria


"Mustang" wrote:

Hi there,

I am having problems finding a solution to a problem I have been given. I
have a workbook which on one sheet we log:

Job No Weekly $ Start Date End Date No of days

This information is filtered through to a monthly sheet where I filter by
job number. My problem is that I know the total number of days our equipment
has been hired for which is fine if they hire something for just one billing
month or part of that month BUT we run our invoicing from 21st month to 20th
of the next month.

So if we are charging for June this would be from 21/6/09 - 20/7/09. So if
the Start date is 21/6/09 but end date is 5/5/09 - how can I ask Excel to
work out just the number of days on hire for the June billing period?
Bearing in mind that the dates could also be say 21/6/09 - 29/6/09. I hope
this makes sense!

Any ideas on how I can ask Excel to work out based on the Month - how many
days a piece of equipment has been hired for?

Any ideas would be appreciated.


  #7   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 37
Default Help with a date formula

Thanks Ron,

I have tried this and tested this also against a date range of 21/5/09 -
29/08/09 and I get the answer of 30.

The missing part for me is where I can tell Excel which billing month I am
in, so if I am billing for August I am looking for the answer of 9 days but
this formula gives me 29 days. Any ideas?

Thanks


"Ron Rosenfeld" wrote:

On Mon, 29 Jun 2009 21:23:01 -0700, Mustang
wrote:

Hi there,

I am having problems finding a solution to a problem I have been given. I
have a workbook which on one sheet we log:

Job No Weekly $ Start Date End Date No of days

This information is filtered through to a monthly sheet where I filter by
job number. My problem is that I know the total number of days our equipment
has been hired for which is fine if they hire something for just one billing
month or part of that month BUT we run our invoicing from 21st month to 20th
of the next month.

So if we are charging for June this would be from 21/6/09 - 20/7/09. So if
the Start date is 21/6/09 but end date is 5/5/09 - how can I ask Excel to
work out just the number of days on hire for the June billing period?
Bearing in mind that the dates could also be say 21/6/09 - 29/6/09. I hope
this makes sense!

Any ideas on how I can ask Excel to work out based on the Month - how many
days a piece of equipment has been hired for?

Any ideas would be appreciated.


In general, you can use this formula:

=SUMPRODUCT(--(MONTH(ROW(INDIRECT(Start_Date&":"&End_Date)))=Mon thNumber))


So for June:

=SUMPRODUCT(--(MONTH(ROW(INDIRECT(Start_Date&":"&End_Date)))=6))



Note that for versions of Excel prior to 2007, you may run into the

"dreaded 4 Jun 2079" problem

after which this formula will no longer work :-))

--ron

  #8   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5,651
Default Help with a date formula

On Tue, 30 Jun 2009 13:57:01 -0700, Mustang
wrote:

Thanks Ron,

I have tried this and tested this also against a date range of 21/5/09 -
29/08/09 and I get the answer of 30.

The missing part for me is where I can tell Excel which billing month I am
in, so if I am billing for August I am looking for the answer of 9 days but
this formula gives me 29 days. Any ideas?

Thanks


I cannot tell from what you write if you are getting a result of 30, or 29 from
my formula???

But from this posting, and your previous postings, your date entry format is
not clear. I had assumed it was a dd/mm/yy format, and also a dd/m/yy format,
but that, applied to your data above, would result in dates of 21 May 2009 to
29 Aug 2009 which, so far as I can see, would result in 29 days in the month of
August (which is what my formula returns). Since you are expecting only 9
days, are you trying to enter dates in a yy/mm/dd format? That would give you
a start date of 9 May 2021 and an end date of 9 Aug 2029 which would result in
9 billable days in August of 2029, but doesn't really make much sense.

So please state unambiguously what the date 21/08/09 means; and also what the
date 21/5/09 means.

So far as I can see, if the date range is 21 May 2009 to 29 Aug 2009, there
should be 29 days in August.
--ron
  #9   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 37
Default Help with a date formula


Sorry I mistyped the dates. My date range is 21/5/09 - 29/08/09

I tested it for June (month 6) and got an answer of 30, which is correct for
how we bill.

Thanks


"Ron Rosenfeld" wrote:

On Tue, 30 Jun 2009 13:57:01 -0700, Mustang
wrote:

Thanks Ron,

I have tried this and tested this also against a date range of 21/5/09 -
29/08/09 and I get the answer of 30.

The missing part for me is where I can tell Excel which billing month I am
in, so if I am billing for August I am looking for the answer of 9 days but
this formula gives me 29 days. Any ideas?

Thanks


I cannot tell from what you write if you are getting a result of 30, or 29 from
my formula???

But from this posting, and your previous postings, your date entry format is
not clear. I had assumed it was a dd/mm/yy format, and also a dd/m/yy format,
but that, applied to your data above, would result in dates of 21 May 2009 to
29 Aug 2009 which, so far as I can see, would result in 29 days in the month of
August (which is what my formula returns). Since you are expecting only 9
days, are you trying to enter dates in a yy/mm/dd format? That would give you
a start date of 9 May 2021 and an end date of 9 Aug 2029 which would result in
9 billable days in August of 2029, but doesn't really make much sense.

So please state unambiguously what the date 21/08/09 means; and also what the
date 21/5/09 means.

So far as I can see, if the date range is 21 May 2009 to 29 Aug 2009, there
should be 29 days in August.
--ron

  #10   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5,651
Default Help with a date formula

On Tue, 30 Jun 2009 16:51:01 -0700, Mustang
wrote:

Sorry I mistyped the dates. My date range is 21/5/09 - 29/08/09

I tested it for June (month 6) and got an answer of 30, which is correct for
how we bill.

Thanks


Well, then I don't understand how you got a result of 29 for the month of
August.


So as not to have to deal with typos, please post the exact formula you used.

Don't TYPE it into your response. Rather select the formula in the Excel
formula bar; then copy it and paste it into your response.

Please do the same with your start-date and end-date data.

I do get a result of 9 when using the dates you provide above,

Start Date End Date
21-May-2009 09-Aug-2009


and testing for the month of August.
--ron


  #11   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 37
Default Help with a date formula

Hi Ron,

On my first sheet (Quoted Job No Master) the dates are laid out as:

H I
1
2 Start Date End Date
3 21/05/09 29/08/09

On the monthly job sheet (there is one sheet that is re-used each month) to
try and work out the number of days on hire for the billing month I have
tried your formula and for August it looks like:

=SUMPRODUCT(--(MONTH(ROW(INDIRECT('Quoted Job No Master'!H3&":"&'Quoted Job
No Master'!I3)))=8))

Hopefully you will be able to let me know what I have done incorrectly.

Thanks so much for all your help.


"Ron Rosenfeld" wrote:

On Tue, 30 Jun 2009 16:51:01 -0700, Mustang
wrote:

Sorry I mistyped the dates. My date range is 21/5/09 - 29/08/09

I tested it for June (month 6) and got an answer of 30, which is correct for
how we bill.

Thanks


Well, then I don't understand how you got a result of 29 for the month of
August.


So as not to have to deal with typos, please post the exact formula you used.

Don't TYPE it into your response. Rather select the formula in the Excel
formula bar; then copy it and paste it into your response.

Please do the same with your start-date and end-date data.

I do get a result of 9 when using the dates you provide above,

Start Date End Date
21-May-2009 09-Aug-2009


and testing for the month of August.
--ron

  #12   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5,651
Default Help with a date formula

On Wed, 1 Jul 2009 16:43:01 -0700, Mustang
wrote:

Hi Ron,

On my first sheet (Quoted Job No Master) the dates are laid out as:

H I
1
2 Start Date End Date
3 21/05/09 29/08/09

On the monthly job sheet (there is one sheet that is re-used each month) to
try and work out the number of days on hire for the billing month I have
tried your formula and for August it looks like:

=SUMPRODUCT(--(MONTH(ROW(INDIRECT('Quoted Job No Master'!H3&":"&'Quoted Job
No Master'!I3)))=8))

Hopefully you will be able to let me know what I have done incorrectly.

Thanks so much for all your help.


OK, you are not doing anything wrong. It was ME who did not read your initial
specifications closely enough. In particular, I missed the part about your
billing month starting on the 21st day of the month and ends on the 20th day of
the succeeding month.

Let me suggest this formula:

=SUMPRODUCT((ROW(INDIRECT(StartDate&":"&EndDate)) =DATE(YEAR(K3),MONTH(K3),21))*
(ROW(INDIRECT(StartDate&":"&EndDate))<=DATE(YEAR(K 3),MONTH(K3)+1,20)))

In this instance, K3 has some date (it can be any date) in the month of
interest. You could format that cell to show just the month name, or month and
year.

And by the way, this formula DOES give a result of 9 for the month of August,
which I now realize covers 21-Aug through 29-Aug inclusive.



--ron
  #13   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 37
Default Help with a date formula


Thank you SO much you have been really helpful. Your time is appreciated!


"Ron Rosenfeld" wrote:

On Wed, 1 Jul 2009 16:43:01 -0700, Mustang
wrote:

Hi Ron,

On my first sheet (Quoted Job No Master) the dates are laid out as:

H I
1
2 Start Date End Date
3 21/05/09 29/08/09

On the monthly job sheet (there is one sheet that is re-used each month) to
try and work out the number of days on hire for the billing month I have
tried your formula and for August it looks like:

=SUMPRODUCT(--(MONTH(ROW(INDIRECT('Quoted Job No Master'!H3&":"&'Quoted Job
No Master'!I3)))=8))

Hopefully you will be able to let me know what I have done incorrectly.

Thanks so much for all your help.


OK, you are not doing anything wrong. It was ME who did not read your initial
specifications closely enough. In particular, I missed the part about your
billing month starting on the 21st day of the month and ends on the 20th day of
the succeeding month.

Let me suggest this formula:

=SUMPRODUCT((ROW(INDIRECT(StartDate&":"&EndDate)) =DATE(YEAR(K3),MONTH(K3),21))*
(ROW(INDIRECT(StartDate&":"&EndDate))<=DATE(YEAR(K 3),MONTH(K3)+1,20)))

In this instance, K3 has some date (it can be any date) in the month of
interest. You could format that cell to show just the month name, or month and
year.

And by the way, this formula DOES give a result of 9 for the month of August,
which I now realize covers 21-Aug through 29-Aug inclusive.



--ron

  #14   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5,651
Default Help with a date formula

On Wed, 1 Jul 2009 20:18:08 -0700, Mustang
wrote:

Thank you SO much you have been really helpful. Your time is appreciated!


You're welcome. Glad to help. Sorry for the initial mix-up.
--ron
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
Create a formula in a date range to locate a specific date - ecel util Excel Discussion (Misc queries) 0 February 19th 07 03:03 PM
Excel Formula to calulate number of days passed from date to date K. Mack Excel Discussion (Misc queries) 8 January 4th 07 11:27 PM
Formula for determining if two date columns fall within specific date range Igottabeme Excel Worksheet Functions 2 April 21st 06 02:50 AM
Formula for determining if two date columns fall within specific date range Igottabeme Excel Discussion (Misc queries) 1 April 20th 06 10:03 PM
formula to calculate future date from date in cell plus days Chicesq Excel Worksheet Functions 8 November 3rd 05 12:25 PM


All times are GMT +1. The time now is 10:43 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"