+ Reply to Thread
Results 1 to 8 of 8

easy (?) subtraction problem

  1. #1
    Tim Marsh
    Guest

    easy (?) subtraction problem

    Hi All,

    Its the end of a long week here and my brain has already shut-down for the
    weekend.

    can someone tell me how i can subtract one year from a date. eg, if the
    initial date is 19/09/2006 in cell A1 how do i calculate to get the result
    of 19/09/2005 in cell B2? i need to do this for two sets of approx. 3000
    dates.

    i can't think what formula or vba i would use even though it seems soooo
    simple! i can't simply subtract 365 days because some might be in a leap
    year.

    tia,

    Tim



  2. #2
    markwalling
    Guest

    RE: easy (?) subtraction problem

    DateSerial() is what i think you are looking for
    --
    "if you give a man a fish, you feed him for a day. if you teach a man to
    fish, you feed him for a lifetime."


    "Tim Marsh" wrote:

    > Hi All,
    >
    > Its the end of a long week here and my brain has already shut-down for the
    > weekend.
    >
    > can someone tell me how i can subtract one year from a date. eg, if the
    > initial date is 19/09/2006 in cell A1 how do i calculate to get the result
    > of 19/09/2005 in cell B2? i need to do this for two sets of approx. 3000
    > dates.
    >
    > i can't think what formula or vba i would use even though it seems soooo
    > simple! i can't simply subtract 365 days because some might be in a leap
    > year.
    >
    > tia,
    >
    > Tim
    >
    >
    >


  3. #3
    Ardus Petus
    Guest

    Re: easy (?) subtraction problem

    =DATE(YEAR(A1)-1,MONTH(A1),DAY(A1))

    NB:will return 01/03/2003 if A1=29/2/2004

    HTH
    --
    AP


    "Tim Marsh" <tmarsh-trousers-@-take off my trousers to
    reply-blueyonder.co.uk> a écrit dans le message de news:
    %[email protected]...
    > Hi All,
    >
    > Its the end of a long week here and my brain has already shut-down for the
    > weekend.
    >
    > can someone tell me how i can subtract one year from a date. eg, if the
    > initial date is 19/09/2006 in cell A1 how do i calculate to get the result
    > of 19/09/2005 in cell B2? i need to do this for two sets of approx. 3000
    > dates.
    >
    > i can't think what formula or vba i would use even though it seems soooo
    > simple! i can't simply subtract 365 days because some might be in a leap
    > year.
    >
    > tia,
    >
    > Tim
    >




  4. #4
    Bob Phillips
    Guest

    Re: easy (?) subtraction problem

    =DATE(YEAR(A1)-1,MONTH(A1),DAY(A1))

    --
    HTH

    Bob Phillips

    (replace somewhere in email address with gmail if mailing direct)

    "Tim Marsh" <tmarsh-trousers-@-take off my trousers to
    reply-blueyonder.co.uk> wrote in message
    news:%[email protected]...
    > Hi All,
    >
    > Its the end of a long week here and my brain has already shut-down for the
    > weekend.
    >
    > can someone tell me how i can subtract one year from a date. eg, if the
    > initial date is 19/09/2006 in cell A1 how do i calculate to get the result
    > of 19/09/2005 in cell B2? i need to do this for two sets of approx. 3000
    > dates.
    >
    > i can't think what formula or vba i would use even though it seems soooo
    > simple! i can't simply subtract 365 days because some might be in a leap
    > year.
    >
    > tia,
    >
    > Tim
    >
    >




  5. #5
    Tim Marsh
    Guest

    Re: easy (?) subtraction problem

    thanks for teh reply Mark. it was actually the cell formatting that was
    throwing me off course. i got it to work with: -

    ActiveCell.Value = DateSerial(Year(ActiveCell.Offset(0, -1)) - 1,
    Month(ActiveCell.Offset(0, -1)), Day(ActiveCell.Offset(0, -1)))

    but i still think there might be an easier way.... never mind - nearly
    saturday!

    Tim

    "markwalling" <[email protected]> wrote in message
    news:[email protected]...
    > DateSerial() is what i think you are looking for
    > --
    > "if you give a man a fish, you feed him for a day. if you teach a man to
    > fish, you feed him for a lifetime."
    >
    >
    > "Tim Marsh" wrote:
    >
    >> Hi All,
    >>
    >> Its the end of a long week here and my brain has already shut-down for
    >> the
    >> weekend.
    >>
    >> can someone tell me how i can subtract one year from a date. eg, if the
    >> initial date is 19/09/2006 in cell A1 how do i calculate to get the
    >> result
    >> of 19/09/2005 in cell B2? i need to do this for two sets of approx. 3000
    >> dates.
    >>
    >> i can't think what formula or vba i would use even though it seems soooo
    >> simple! i can't simply subtract 365 days because some might be in a leap
    >> year.
    >>
    >> tia,
    >>
    >> Tim
    >>
    >>
    >>




  6. #6
    TomB.
    Guest

    RE: easy (?) subtraction problem

    Mark....you got that saying all wrong! It goes like this:

    "If you give a man a fish, you feed him for a day. If you teach a man to
    fish, you must also teach him to lie and drink beer."

    Good times to all,
    TomB.


    "markwalling" wrote:

    > DateSerial() is what i think you are looking for
    > --
    > "if you give a man a fish, you feed him for a day. if you teach a man to
    > fish, you feed him for a lifetime."
    >
    >
    > "Tim Marsh" wrote:
    >
    > > Hi All,
    > >
    > > Its the end of a long week here and my brain has already shut-down for the
    > > weekend.
    > >
    > > can someone tell me how i can subtract one year from a date. eg, if the
    > > initial date is 19/09/2006 in cell A1 how do i calculate to get the result
    > > of 19/09/2005 in cell B2? i need to do this for two sets of approx. 3000
    > > dates.
    > >
    > > i can't think what formula or vba i would use even though it seems soooo
    > > simple! i can't simply subtract 365 days because some might be in a leap
    > > year.
    > >
    > > tia,
    > >
    > > Tim
    > >
    > >
    > >


  7. #7
    Norman Jones
    Guest

    Re: easy (?) subtraction problem

    Hi Tim,

    One way:

    =DATE(YEAR(A1)-1,MONTH(A1),DAY(A1))


    ---
    Regards,
    Norman



    "Tim Marsh" <tmarsh-trousers-@-take off my trousers to
    reply-blueyonder.co.uk> wrote in message
    news:%[email protected]...
    > Hi All,
    >
    > Its the end of a long week here and my brain has already shut-down for the
    > weekend.
    >
    > can someone tell me how i can subtract one year from a date. eg, if the
    > initial date is 19/09/2006 in cell A1 how do i calculate to get the result
    > of 19/09/2005 in cell B2? i need to do this for two sets of approx. 3000
    > dates.
    >
    > i can't think what formula or vba i would use even though it seems soooo
    > simple! i can't simply subtract 365 days because some might be in a leap
    > year.
    >
    > tia,
    >
    > Tim
    >




  8. #8
    Tim Marsh
    Guest

    Re: easy (?) subtraction problem

    thank you all - job done!!

    "Norman Jones" <[email protected]> wrote in message
    news:%[email protected]...
    > Hi Tim,
    >
    > One way:
    >
    > =DATE(YEAR(A1)-1,MONTH(A1),DAY(A1))
    >
    >
    > ---
    > Regards,
    > Norman
    >
    >
    >
    > "Tim Marsh" <tmarsh-trousers-@-take off my trousers to
    > reply-blueyonder.co.uk> wrote in message
    > news:%[email protected]...
    >> Hi All,
    >>
    >> Its the end of a long week here and my brain has already shut-down for
    >> the weekend.
    >>
    >> can someone tell me how i can subtract one year from a date. eg, if the
    >> initial date is 19/09/2006 in cell A1 how do i calculate to get the
    >> result of 19/09/2005 in cell B2? i need to do this for two sets of
    >> approx. 3000 dates.
    >>
    >> i can't think what formula or vba i would use even though it seems soooo
    >> simple! i can't simply subtract 365 days because some might be in a leap
    >> year.
    >>
    >> tia,
    >>
    >> Tim
    >>

    >
    >




+ 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