• Adding hours to a date and time

    Author
    Topic
    #498958

    Dear loungers,

    I have a column that contains a data and time. This will be used in a calculation where what i am adding is either days or hours. How do I do this – since the column is both date and time the functions DATE and TIME don’t work.

    For Example: [INDENT]1 April 2015, 12:00 plus 8 hours should give me 1 April 2015, 20:00
    1 April 2015, 12:00 plus 20 hours should give me 2 April 2015, 10:00
    [/INDENT]

    Any ideas?

    thank you…………… liz

    Viewing 3 reply threads
    Author
    Replies
    • #1494407

      To Myself,

      if you have a column with the hours and minutes and do a normal addition it will work
      if you need to add to a date in a formula with a value in a formatted column I don’t think it can be done

      liz

      • #1494410

        Hi lizat

        ..see attached file.
        Does this give you what you want???

        col has a custom format of 0.00 “hrs”, so if you enter 8 you will see 8.00 hrs

        zeddy

        • #1494412

          Hi lizat

          ..and when you add the hours value, you just divide it by 24 to get the value in days, and then add that to your first date/time value.

          zeddy

    • #1494435

      Dates are just numbers, where 1 = 1 day and an hour = 1/24. As long as you keep your inputs in the correct format all will be well.
      e.g. to enter 8 hours type: 8:0, 8:00 or 8:
      If you want to use real numbers as hours you need to convert by dividing by 24.

      cheers, Paul

      • #1494686

        I see that you have the day first. In that case use this format: dd, mmmm yyyy hh:mm

        39750-lizat2

        1 April 2015, 12:00 plus 20 hours should give me 2 April 2015, 10:00

        Should be: 1 April 2015, 12:00 plus 20 hours should give me 2 April 2015, 08:00

        • #1494717

          Hi Maud

          The comma is in a different place in post#1, and there is no leading zero for the day.

          ..so I updated my file too

          zeddy

    • #1494685

      Lizat,

      Set you cell formatting as mmmm dd, yyyy hh:mm for both the start date (Col A) and the cells with the time increments you are adding (Col B). Use this formula in column B:
      Cell B1 =A1 + TIME(9,0,0)
      Cell B2 =A2 + TIME(20,0,0)

      39749-lizat

      HTH,
      Maud

    • #1494720

      Very observant as always Zeddy. That would mean I would have to change the cell format to:

      d mmmm yyyy, hh:mm

      • #1494935

        Hi Maud

        I wouldn’t say my eyes were brilliant, but on a clear night I can see as far as the moon.

        zeddy

    Viewing 3 reply threads
    Reply To: Adding hours to a date and time

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: