+ Reply to Thread
Results 1 to 8 of 8

Date and Time conversion to hours?

Hybrid View

  1. #1
    Registered User
    Join Date
    11-04-2010
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    4

    Date and Time conversion to hours?

    I have two date and time fields

    A - 01/10/2010 10:33
    B - 10/10/2010 15:00

    They are formatted as dd/mm/yyyy hh:mm

    I am trying to come up with a formula that will tell me the difference in hours (monday to friday) between A and B

    So 10/10/2010 15:00 - 01/10/2010 10:33 = X hours

    Any ideas?
    Last edited by hainsworth; 11-04-2010 at 12:17 PM.

  2. #2
    Forum Expert Domski's Avatar
    Join Date
    12-14-2009
    Location
    A galaxy far, far away
    MS-Off Ver
    Darth Office 2010
    Posts
    3,950

    Re: Date and Time conversion to hours?

    =(A2-A1)*24

    Dom
    "May the fleas of a thousand camels infest the crotch of the person who screws up your day and may their arms be too short to scratch..."

    Use code tags when posting your VBA code: [code] Your code here [/code]

    Remember, saying thanks only takes a second or two. Click the little star to give some Rep if you think an answer deserves it.

  3. #3
    Registered User
    Join Date
    11-04-2010
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Date and Time conversion to hours?

    Have tried that and doesnt return a value in hours no matter how i format

  4. #4
    Forum Expert Domski's Avatar
    Join Date
    12-14-2009
    Location
    A galaxy far, far away
    MS-Off Ver
    Darth Office 2010
    Posts
    3,950

    Re: Date and Time conversion to hours?

    You should just be able to format the result as General, I get 220.45.

    Dom

  5. #5
    Forum Expert Domski's Avatar
    Join Date
    12-14-2009
    Location
    A galaxy far, far away
    MS-Off Ver
    Darth Office 2010
    Posts
    3,950

    Re: Date and Time conversion to hours?

    Just A2-A1 formatted as [h]:mm will give the result as hours and minutes.

    Dom

  6. #6
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    Microsoft 365
    Posts
    14,844

    Re: Date and Time conversion to hours?

    You say you want Monday to Friday hours - are you counting all 24 hours on an MF? 1st Oct 2010 was a Friday so 10:33 to midnight = 13:27 then as the 10th is a Sunday you have to count 5 days Mon 4th to Fri 8th of the following week = 24:00*5+13:27= 133:27 is that the required answer?

    To get that then with start time/date in A2 and end time/date in B2 use this formula in C2

    =NETWORKDAYS(A2,B2)-1+IF(NETWORKDAYS(B2,B2),MOD(B2,1),1)-NETWORKDAYS(A2,A2)*MOD(A2,1)

    format C2 as [h]:mm

    note the square brackets
    Audere est facere

  7. #7
    Registered User
    Join Date
    11-04-2010
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Date and Time conversion to hours?

    You Are Correct 100% thank you Very Much

    Now ..... lol

    Is there a way to remove any weekends or am i pushing my luck?

  8. #8
    Registered User
    Join Date
    11-04-2010
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Date and Time conversion to hours?

    Daddy Long Legs you are the Daddy!!!

+ 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