PC Review


Reply
Thread Tools Rate Thread

Custom date Calculations

 
 
nine
Guest
Posts: n/a
 
      23rd Feb 2008
I would like to calculate the age in months between 2 custom date codes.

The date code format is as follows: 10804Where the 3 most significant digits
= year, in this case 2008, and the 2 least significant digits = week of the
yearin this case 04. The highest possible week code is 52, the last week of
a given year. So using this example I would like to calculate the number of
months between 10804and 10229.

The problem is these numbers don't subtract very nicely since they are not
your normal format.

Is there a good solution to this question?

Thanks in advance for the help.

Dave


 
Reply With Quote
 
 
 
 
Ron Coderre
Guest
Posts: n/a
 
      23rd Feb 2008
Try this (in 2 sections for readability):

=DATEDIF(DATE("20"&MID(A1,2,2),1,MOD(A1,100)*7),
DATE("20"&MID(B1,2,2),1,MOD(B1,100)*7),"m")

Is that something you can work with?
--------------------------

Regards,

Ron
Microsoft MVP (Excel)
(XL2003, Win XP)

"nine" <(E-Mail Removed)> wrote in message
news:kkZvj.12215$(E-Mail Removed)...
>I would like to calculate the age in months between 2 custom date codes.
>
> The date code format is as follows: 10804Where the 3 most significant
> digits = year, in this case 2008, and the 2 least significant digits =
> week of the yearin this case 04. The highest possible week code is 52, the
> last week of a given year. So using this example I would like to calculate
> the number of months between 10804and 10229.
>
> The problem is these numbers don't subtract very nicely since they are not
> your normal format.
>
> Is there a good solution to this question?
>
> Thanks in advance for the help.
>
> Dave
>




 
Reply With Quote
 
Ron Rosenfeld
Guest
Posts: n/a
 
      23rd Feb 2008
On Sat, 23 Feb 2008 18:10:24 GMT, "nine" <(E-Mail Removed)> wrote:

>I would like to calculate the age in months between 2 custom date codes.
>
>The date code format is as follows: 10804Where the 3 most significant digits
>= year, in this case 2008, and the 2 least significant digits = week of the
>yearin this case 04. The highest possible week code is 52, the last week of
>a given year. So using this example I would like to calculate the number of
>months between 10804and 10229.
>
>The problem is these numbers don't subtract very nicely since they are not
>your normal format.
>
>Is there a good solution to this question?
>
>Thanks in advance for the help.
>
>Dave
>


Another problem is that it is not clear what your dates refer to.

You write that "The highest possible week code is 52, the last week of
a given year".

What dates, exactly, would that be. Because if it is, for example 12/25/2008 -
12/31/2008, then week 1 cannot start on 1/1/2008 since this year has 366 days.

There would be two days difference this year, depending on if you started
counting from the beginning, or the end of the year.

Another problem with regard to calculating the number of months between two
dates is that months can have anywhere from 28-31 days.

There are a different ways of determining week numbers, but we need to know
which one you are using.

There are also methods of "normalizing" month differences but, again, we need
to know which you want to use.
--ron
 
Reply With Quote
 
Dave
Guest
Posts: n/a
 
      23rd Feb 2008

Ron Rosenfeld <(E-Mail Removed)> wrote:

>On Sat, 23 Feb 2008 18:10:24 GMT, "nine" <(E-Mail Removed)> wrote:
>
>>I would like to calculate the age in months between 2 custom date codes.
>>
>>The date code format is as follows: 10804Where the 3 most significant digits
>>= year, in this case 2008, and the 2 least significant digits = week of the
>>yearin this case 04. The highest possible week code is 52, the last week of
>>a given year. So using this example I would like to calculate the number of
>>months between 10804and 10229.
>>
>>The problem is these numbers don't subtract very nicely since they are not
>>your normal format.
>>
>>Is there a good solution to this question?
>>
>>Thanks in advance for the help.
>>
>>Dave
>>

>
>Another problem is that it is not clear what your dates refer to.
>
>You write that "The highest possible week code is 52, the last week of
>a given year".
>
>What dates, exactly, would that be. Because if it is, for example 12/25/2008 -
>12/31/2008, then week 1 cannot start on 1/1/2008 since this year has 366 days.
>
>There would be two days difference this year, depending on if you started
>counting from the beginning, or the end of the year.
>
>Another problem with regard to calculating the number of months between two
>dates is that months can have anywhere from 28-31 days.
>
>There are a different ways of determining week numbers, but we need to know
>which one you are using.
>
>There are also methods of "normalizing" month differences but, again, we need
>to know which you want to use.
>--ron




I don't need to be specific to the day in this case all I really need is the number of
months difference between the date codes given, so I can tolerate some rounding, if
needed.

As far as which method is used for determining week numbers, week 1 is the first full
week of the year. I hope that is what you are looking for.

Dave

 
Reply With Quote
 
Ron Rosenfeld
Guest
Posts: n/a
 
      23rd Feb 2008
On Sat, 23 Feb 2008 22:09:31 GMT, "Dave" <(E-Mail Removed)> wrote:

>I don't need to be specific to the day in this case all I really need is the number of
>months difference between the date codes given, so I can tolerate some rounding, if
>needed.
>
>As far as which method is used for determining week numbers, week 1 is the first full
>week of the year. I hope that is what you are looking for.
>
>Dave


Given that, Ron C's solution should work just fine for you.
--ron
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Pvt Tables - Custom Calculations - HELP ME!! Healthya Microsoft Excel Worksheet Functions 1 25th Sep 2009 03:11 AM
Custom Calculations =?Utf-8?B?cGl2b3QgdGFibGUgZHJvcCBkb3duIHZhbHVlcw== Microsoft Excel Misc 7 12th Nov 2006 04:45 PM
Pivot Table Custom Calculations =?Utf-8?B?Q2Fzc2llTQ==?= Microsoft Excel Misc 1 7th Nov 2005 09:43 PM
Pivot Table custom calculations Jeffrey Microsoft Excel Misc 2 16th Apr 2004 05:43 PM
Custom Calculations in Subtotal CST Microsoft Excel Programming 4 11th Jul 2003 09:21 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:57 AM.