+ Reply to Thread
Results 1 to 10 of 10

a difficult date and month calculation problem

  1. #1
    Registered User
    Join Date
    10-06-2011
    Location
    london
    MS-Off Ver
    Excel 2003
    Posts
    43

    a difficult date and month calculation problem

    I have five columns for one excel file using 2003 version
    column A column B column C column D column E
    27.8.2009 5 01.10.2011 X Y

    column B means five years, X is derived by A+B-C in terms of years, column E is in terms of month. so for above example, X will be 2 (years) , Y will be 10 (months)

    my major problem is how to design formula for column D and E? I have around 1000 such records

    all columns are defined as general category, even if I try to format cells to "date" for column A
    it can't be changed, so how to solve the issue? thanks

  2. #2
    Valued Forum Contributor quekbc's Avatar
    Join Date
    01-18-2010
    Location
    Sydney, Australia
    MS-Off Ver
    2010, 2013, 2016
    Posts
    1,149

    Re: a difficult date and month calculation problem

    Are the dates typed in as text or as proper dates? Try typing =YEAR(A1) and see if it produces a number.

    It'll makes things easier if they are stored as proper dates.

  3. #3
    Forum Expert Bob Phillips's Avatar
    Join Date
    09-03-2005
    Location
    Wessex
    MS-Off Ver
    Office 2003, 2010, 2013, 2016, 365
    Posts
    3,284

    Re: a difficult date and month calculation problem

    Try

    =DATEDIF(DATE(RIGHT(C3,4),SUBSTITUTE(MID(C3,LEN(C3)-6,2),".",""),LEFT(3,FIND(".",C3)-1)),
    DATE(RIGHT(A3,4)+B3,SUBSTITUTE(MID(A3,LEN(A3)-6,2),".",""),LEFT(A3,FIND(".",A3)-1)),"Y")

    and

    =DATEDIF(DATE(RIGHT(C3,4),SUBSTITUTE(MID(C3,LEN(C3)-6,2),".",""),LEFT(3,FIND(".",C3)-1)),
    DATE(RIGHT(A3,4)+B3,SUBSTITUTE(MID(A3,LEN(A3)-6,2),".",""),LEFT(A3,FIND(".",A3)-1)),"YM")

  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,090

    Re: a difficult date and month calculation problem

    27.8.2009 isn't a valid date format, hence you have text in a cell that looks similar to a date.

    You could try selecting all the cells with "dates" in them, formatting them as date and then doing a global replace of "." by "/".

    Alternatively, you'll have to extract the month and year using MID.

    Other than that, I'm not really sure I understand the calculations involved. Perhaps you could break it down? Column D (X) = ?+?+?

    Regards

    Regards
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  5. #5
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: a difficult date and month calculation problem

    The data that you have in the B column is posing a bit of a problem.

    I have got the X using =YEAR(A2)+B2-YEAR(C2)

    but the answer i get is 3.

    Also, i used the Datedif function to get Y, but i am not sure how to i add 5 (col B data) in there.
    The function i used is =DATEDIF(A2,C2,"m"). It returns 25 months which is correct if you count the months between 27th Aug 2009 and 1st October 2011. (Considering that you are in london and using the dd/mm/yy date format).

  6. #6
    Registered User
    Join Date
    10-06-2011
    Location
    london
    MS-Off Ver
    Excel 2003
    Posts
    43

    Re: a difficult date and month calculation problem

    Hi excel 2003 don't have datedif function, the logical is column A is item purchasing day, column B is useful lives , column C is now, column D is remaining useful live in terms of years, column E is remaing useful live in terms of month.

    so pls help to design formula for column D and column E, help, please

  7. #7
    Forum Expert Bob Phillips's Avatar
    Join Date
    09-03-2005
    Location
    Wessex
    MS-Off Ver
    Office 2003, 2010, 2013, 2016, 365
    Posts
    3,284

    Re: a difficult date and month calculation problem

    Quote Originally Posted by jolinchew View Post
    Hi excel 2003 don't have datedif function,
    Yes it does. Doesn't show in help, but it s there. Try it!

  8. #8
    Valued Forum Contributor quekbc's Avatar
    Join Date
    01-18-2010
    Location
    Sydney, Australia
    MS-Off Ver
    2010, 2013, 2016
    Posts
    1,149

    Re: a difficult date and month calculation problem

    Hi jolin,

    The datedif function works in 2003. It's just not documented in Excel. Read...
    http://www.cpearson.com/excel/datedif.aspx

    also, when you say remaining life in years, do you mean 18 months of remaining life should tie in with a 1.5years remaining life? Or are expecting the answer as X = 1, Y = 6 months?

  9. #9
    Registered User
    Join Date
    10-06-2011
    Location
    london
    MS-Off Ver
    Excel 2003
    Posts
    43

    Re: a difficult date and month calculation problem

    giving my example, item is purchased in 2009.8, plus five years, so the last day is 2014.8, now is 2011.10
    the item still has 2 years and 10 month, the problem is how to calculate 10 month in excel. guys pls help

  10. #10
    Valued Forum Contributor quekbc's Avatar
    Join Date
    01-18-2010
    Location
    Sydney, Australia
    MS-Off Ver
    2010, 2013, 2016
    Posts
    1,149

    Re: a difficult date and month calculation problem

    Hi jolin,

    Please refer to the second formula in Bob's first post. It does the trick.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1