saja

Well-known member
  • Jan 8, 2007
    16,123
    2
    10,766
    113
    Home Sweet Home
    =B2-A2

    Important:
    Before applying the formula, be sure to format the cells as time values. For instance, you can use the “h:mm AM/PM” time code or “h:mm:ss” time format. To do that:

    1. Select the cells you’ll be using, right-click on them and select Format Cells. Use the Ctrl + 1 shortcut to quickly launch the “Format Cells” dialog box.
    2. Choose “Time” from the Category list and pick the time format you prefer.
    3. Enter the times you want to compare (start time and end time) as shown in the example below.
    4. In cell C2, type the formula “=B2-A2” (no quotes) and hit the Enter key on your keyboard to get the time difference between the two cells. The time difference will be displayed in hours and minutes. You can use the Custom option to customize the display of your time difference.
    Let’s look at an example in Excel workbook:


    How-to-calculate-time-difference-in-Excel.png


    copied
    https://traqq.com/blog/how-to-calculate-time-difference-in-excel/
     

    kasun090354t

    Well-known member
  • Aug 21, 2011
    24,041
    36,036
    113
    කෑගල්ල
    හරියටම පැය වලින් ඕනේ නම් vba එකක් ලියන්න වෙයි ඕනේ කොලොම් එකේ selection change වෙනකොට.
    එක ඇතුලේ datedeff එකක් ලියන්න වෙයි, datedeff(පළවෙනි වෙලාව, දෙවැනි වෙලාව, "h" output ඕනේ මොනවගේ න් ද කියන එක)
     
    • Like
    Reactions: NRTG