Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 70
Default Date Calculations

I have a worksheet with a beginning and ending date range. I need the number
of months for the range but also need them rounded up to the next month.

For example:

13-Jul-11 to 31-Jul-12 should calculate as 13 months and not the 12 provided
by the DATEDIF function.

In short, I need to round up to the next month for my calculations.

05-Mar-11 to 31-Dec-11 should return 10 full months and not 9.

Is there an easy way to do this?
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 8,856
Default Date Calculations

If you are happy to assume there are 30 days in a month, then this
approximation should work for you:

=ROUNDUP((B2-A2)/30,0)

assuming end date is in B2 and start date is in A2. If you want it
slightly more accurate you can make it 30.4.

Hope this helps.

Pete

On Jul 23, 11:11*pm, Tommy wrote:
I have a worksheet with a beginning and ending date range. I need the number
of months for the range but also need them rounded up to the next month.

For example:

13-Jul-11 to 31-Jul-12 should calculate as 13 months and not the 12 provided
by the DATEDIF function.

In short, I need to round up to the next month for my calculations.

05-Mar-11 to 31-Dec-11 should return 10 full months and not 9.

Is there an easy way to do this?


  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 5,651
Default Date Calculations

On Wed, 23 Jul 2008 15:11:01 -0700, Tommy
wrote:

I have a worksheet with a beginning and ending date range. I need the number
of months for the range but also need them rounded up to the next month.

For example:

13-Jul-11 to 31-Jul-12 should calculate as 13 months and not the 12 provided
by the DATEDIF function.

In short, I need to round up to the next month for my calculations.

05-Mar-11 to 31-Dec-11 should return 10 full months and not 9.

Is there an easy way to do this?


If you can formulate some unambiguous rules, then you could do it.

But, since months can have 28, 29, 30 or 31 days, you need to be more specific.

What about:

15-Feb-11 to 14-Dec-11

and how did you arrive at that result?
--ron
  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default Date Calculations

Add 1 maybe? There is a difference between subtraction and counting...
DATEDIF works by subtraction. Think of it this way.. the difference between
1 and 6 (January and June) is 5, but the number of months involved is 6... 1
greater than the difference.

Rick


"Tommy" wrote in message
...
I have a worksheet with a beginning and ending date range. I need the
number
of months for the range but also need them rounded up to the next month.

For example:

13-Jul-11 to 31-Jul-12 should calculate as 13 months and not the 12
provided
by the DATEDIF function.

In short, I need to round up to the next month for my calculations.

05-Mar-11 to 31-Dec-11 should return 10 full months and not 9.

Is there an easy way to do this?


  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,358
Default Date Calculations

Since you are rounding up, the only time you would not add 1 is if the day of
the month is the same, so this formula should work for you:

=DATEDIF(startdate,enddate,"m")+IF(DAY(startdate)= DAY(enddate),0,1)

--
John C


"Tommy" wrote:

I have a worksheet with a beginning and ending date range. I need the number
of months for the range but also need them rounded up to the next month.

For example:

13-Jul-11 to 31-Jul-12 should calculate as 13 months and not the 12 provided
by the DATEDIF function.

In short, I need to round up to the next month for my calculations.

05-Mar-11 to 31-Dec-11 should return 10 full months and not 9.

Is there an easy way to do this?



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 calculations BrettPotts Excel Discussion (Misc queries) 5 May 5th 08 11:46 AM
More date calculations hurds999 Excel Worksheet Functions 1 April 3rd 08 07:33 PM
Date Calculations before date entered Ma2Weir Excel Discussion (Misc queries) 8 February 1st 07 03:34 AM
Date calculations Brian Excel Discussion (Misc queries) 2 March 8th 06 08:43 PM
Date Calculations mulhod Excel Worksheet Functions 3 July 20th 05 01:37 PM


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