• Hours Calculation Function (Excel 2002)

    Home » Forums » AskWoody support » Productivity software by function » MS Excel and spreadsheet help » Hours Calculation Function (Excel 2002)

    Author
    Topic
    #394061

    Hey people, I was just wondering if anyone had an already made copy of an Excel function that would calculate the difference between two times. For instance:
    A1: 8:30 AM B1: 6:00 PM C1: =9.5
    I know approximately how to do this, but I know it would take me a long time (nested ifs and right functions). Just wanted to check if anyone else has made this already. Thanks,

    -naut

    Viewing 1 reply thread
    Author
    Replies
    • #719315

      Format col A & B to the appropriate time format and format col C to “number” format with two decimal places. In C1 enter =B1-A1*24
      Excel stores times based on a percentage of the day so 6:00 PM equals 0.75 to Excel. So by figuring out the difference and mulitplying by 24 it gives you the elapsed time in a numeric format instead of a time format.

      • #719329

        The formula in C1 needs to be:

        =(B1-A1)*24
        
        • #719337

          D’ Oh! Thanks for correcting my brain cramp!!

          • #719368

            I managed to make one on my own, it is very different compare to what you have:
            =(HOUR(B1)-12) + (12-HOUR(A1)) – (MINUTE(A1) /60) + (MINUTE(B1) / 60)
            * where A1 is the start time and B1 is the end time. (eg. A1 = 8:00 AM, B1 = 6:30 PM)
            Thanks for the input.

            • #719455

              The one(s) listed above also will take into account days, and seconds and is alot easier.

              Steve

            • #740522

              This is a pretty old thread, but I just figured I post this little update incase anyone else refferes to it. The (B1-A1)*24 formula doesn’t work if you were to work from 4pm to midnight. Here is a fix incase anyone ever needs it:
              =IF((B1-A1)*24>=0, (B1-A1)*24, (B1-A1)*24+24)

            • #740531

              If you add the date to the time, then the (B1-A1)*24 will work just file.

            • #740532

              If you add the date to the time, then the (B1-A1)*24 will work just file.

            • #740536

              [indent]


              The (B1-A1)*24 formula doesn’t work if you were to work from 4pm to midnight


              [/indent]
              Well – yes, it does. See attached.

              Tony.

            • #740537

              [indent]


              The (B1-A1)*24 formula doesn’t work if you were to work from 4pm to midnight


              [/indent]
              Well – yes, it does. See attached.

              Tony.

            • #740523

              This is a pretty old thread, but I just figured I post this little update incase anyone else refferes to it. The (B1-A1)*24 formula doesn’t work if you were to work from 4pm to midnight. Here is a fix incase anyone ever needs it:
              =IF((B1-A1)*24>=0, (B1-A1)*24, (B1-A1)*24+24)

            • #719456

              The one(s) listed above also will take into account days, and seconds and is alot easier.

              Steve

          • #719369

            I managed to make one on my own, it is very different compare to what you have:
            =(HOUR(B1)-12) + (12-HOUR(A1)) – (MINUTE(A1) /60) + (MINUTE(B1) / 60)
            * where A1 is the start time and B1 is the end time. (eg. A1 = 8:00 AM, B1 = 6:30 PM)
            Thanks for the input.

        • #719338

          D’ Oh! Thanks for correcting my brain cramp!!

      • #719330

        The formula in C1 needs to be:

        =(B1-A1)*24
        
      • #719331

        C1 should be:
        (B1-A1)*24

        since you want to SUBTRACT before you multiply. Your calc will subtract the A1*24 from B1.

        Steve

      • #719332

        C1 should be:
        (B1-A1)*24

        since you want to SUBTRACT before you multiply. Your calc will subtract the A1*24 from B1.

        Steve

    • #719316

      Format col A & B to the appropriate time format and format col C to “number” format with two decimal places. In C1 enter =B1-A1*24
      Excel stores times based on a percentage of the day so 6:00 PM equals 0.75 to Excel. So by figuring out the difference and mulitplying by 24 it gives you the elapsed time in a numeric format instead of a time format.

    Viewing 1 reply thread
    Reply To: Reply #740522 in Hours Calculation Function (Excel 2002)

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

    Your information:




    Cancel