Excel defaults to date and time functions: HOUR, MINUTE and SECOND. Consider in detail these three functions in action on specific examples. How, when and where they can be effectively applied, making up various formulas from these functions for working with time.
Examples of using the functions HOUR, MINUTE and SECOND for calculations in Excel
The HOUR function in Excel is designed to determine the hour value from the transmitted time as a parameter and returns data from a range of numeric values from 0 to 23, depending on the format of the temporary record.
The function MINUTE in Excel is used to get the minutes from the transmitted data, which characterizes the time, and returns data from a range of numeric values from 0 to 59.
The SECOND function in Excel is used to get the seconds from data in a time format and returns numeric values from 0 to 59.
Monitoring the daily time clock in Excel using the HOUR function
Example 1. Get the current time, determine how many hours have passed since the beginning of the current day, how many hours left before the beginning of a new day.
Source table:
Let’s define the current moment in the Excel time code:
Calculate the number of hours from the beginning of the day:
- B2 — the current date and time, expressed in the format Date.
Determine the number of hours before the end of the day:
Argument Description:
- 24 — the number of hours per day;
- B3 is the current time in hours, expressed as a numerical value.
Note: The example demonstrates that the result of the work of the HOUR function is a number on which you can perform any arithmetic operation.
Conversion of numbers to time format using the functions HOUR and MINUTE
Example 2. From the application, moments of passing certain events that were recognized by Excel as ordinary numbers were loaded (for example, 13:05 was recognized as the number 1305). It is necessary to convert the obtained values into the time format, select the hours and minutes.
Source data table:
To convert the data, use the function:
=TEXT(B3,»00:00″)
Argument Description:
- B3 — the value recognized by Excel as a normal number;
- «00:00» is the time format.
As a result, we get:
Using the functions HOUR and MINUTE, select the desired values. Similarly, we define the required values for the remaining events:
Example of using the SECOND function in Excel
Example 3. The work day starts at 8:00 am. One worker was systematically late for the previous 10 working days for a few seconds. Determine the total time the employee is late.
Enter the data in the table:
Determine the delay in seconds. Where B3 — data on the time of arrival at work on the first day. Similarly, we define the seconds of delay for the following days:
Determine the total number of seconds of delay:
Where C3:C12 is an array of cells containing seconds of late values. We define the integer value of the minutes of delay, knowing that in 1 min = 60 seconds. As a result, we get:
That is, the total lateness of an employee for 10 days was 263 seconds, which is more than 4 minutes.
Features syntax functions HOUR, MINUTE and SECOND in Excel
The HOUR function has the following syntax entry:
=HOUR(serial_number)
- serial_number is the only function argument (required) that characterizes time data that contains data about the clock.
Notes:
- If a string with text that does not contain time information is passed as an argument to the HOUR function, the error code #VAL! Will be returned.
- If the logical data type (TRUE, FALSE) or a reference to an empty cell was passed as an argument to the HOUR function, the value 0 will be returned.
- There are several permitted data formats that the HOUR function accepts:
- In Excel time code (range of values from 0 to 2958465), while the integers correspond to days, fractional — hours, minutes and seconds. For example, 43284.5 is the number of days elapsed between the current moment and the starting point of reference in Excel (01/01/1900 is a conditional date). Fractional part 0.5 corresponds to 12 hours (half of the day).
- In the form of a text string, for example =HOUR(“11:57”). The result of the function — the number 11.
- In the format of the Date and Time Excel. For example, the function will return the values of the clock if, as an argument, it receives a reference to the cell containing the value “07/03/18 11:24” in the date format.
- As a result of the function that returns data in a time format. For example, the function =HOUR(TIMEVALUE(“1:34”)) returns the value 1.
The MINUTE function has the following syntax:
=MINUTE(serial_number)
- serial_number is a required argument describing the value from which the minutes will be calculated.
Notes:
- As in the case of the HOUR function, the MINUTE function accepts text and numeric data in the format of Dates and Times.
- If the argument of this function is an empty text string (“”) or a string containing text (“some text”), the error #VALUE! Will be returned.
- The function supports date format in Excel time code (for example, =MINUTE(0.34) returns the value 9).
The syntax of the SECOND function in Excel is:
=SECOND(serial_number)
- serial_number is the only argument represented as data from which the seconds will be calculated (required for filling).
Download examples HOUR, MINUTE and SECOND to work with time in Excel
Notes:
- The SECOND function works with text and numeric data types representing Date and Time in Excel.
- Error #VALUE! will occur in cases where the argument is a text string that does not contain data characterizing the time.
- The function also calculates seconds from the number represented in the Excel time code (for example, =SECOND(9,567) returns the value 29).
Excel stores Date and Time in number format. To convert hours from one standard time format to others, we can use the CONVERT Function.
CONVERT function converts a number from one measurement system to another.
Syntax:
=CONVERT(number,from_unit,to_unit)
Let’s do this with an example
In column A, we have Minutes &we need to convert the number of Minutes to Hours in column B.
The second argument in the Convert Function is from_unit which is “mn” for Minutes.
In the third argument enter or select to_unit as “hr” for Hour.
Applying the above formula
Copy the formula in other cells, select the cells taking the first cell where the formula is already applied, use shortcut key CTRL + D.
Desired output will be like shown below
Hope you learned how to use conversion using CONVERT function. You can perform these functions Excel 2013 and 2010. Explore more articles on conversion here. Please let us know if you have any unresolved query. We will help you.
Related Articles:
How to use the Stone to lbs weight in Excel
How to use the minutes to hours and minutes
How to Convert Date and Time from GMT to CST
Popular Articles:
50 Excel Shortcut to Increase Your Productivity
How to use the VLOOKUP Function in Excel
How to use the COUNTIF function in Excel 2016
How to use the SUMIF Function in Excel
How to Use Excel > Excel Formula > How to Convert Time to Hours, Minutes and Seconds in Excel
How to Convert Time to Hours, Minutes and Seconds in Excel
Table of contents :
- Convert Time to Hours in Excel
- Formula #1, using multiplication formula
- Formula #2, using CONVERT function
- Formula #3, using HOUR, MINUTE and SECOND function
- Convert Time to Minutes in Excel
- Formula #1, using multiplication formula
- Formula #2, using CONVERT function
- Formula #3, using HOUR, MINUTE and SECOND function
- Convert Time to Seconds in Excel
- Formula #1, using multiplication formula
- Formula #2, using CONVERT function
- Formula #3, using HOUR, MINUTE and SECOND function
- Which One is the Best Solution?
Excel stores TIME values in decimal numbers, but in day unit. The first way to convert a time value to hours, minutes or seconds number is to use the multiplication formula.
The second way is using the excel CONVERT function, an excel function to convert from and to various units of measurement.
The third way to use the excel HOUR function, excel MINUTE function and excel SECOND function, but still involves mathematical formulas (multiplication or division).
For example, there is a TIME value in column A as shown below. How the conversion results to hours, minutes and seconds.
Convert Time to Hours in Excel
Formula #1, using multiplication formula
How to convert time to hours in excel? One day is 24 hours, to get the hour number from a TIME value is to multiply it by the number 24.
The Formula
=A3*24
The Result
Formula #2, using CONVERT function
Fill the number argument with cell A3
Fill the from_unit argument with “day”
Fill the to_unit argument with “hr”
The Formula
=CONVERT(A3,"day","hr")
The Result
The results are the same as the first way.
Formula #3, using HOUR, MINUTE and SECOND function
To get the HOUR number from the time value, why not just use the HOUR function? Why do the MINUTE function and SECOND function also apply?
The TIME value consists of hour, minute and second value. To get the hour value from the minute value divided by 60 (number of minutes in one hour) and to get an hour value from the second value divided by 3600 (number of seconds in one hour).
The Formula
=HOUR(A3)+(MINUTE(A3)/60)+(SECOND(A3)/3600)
The Result
The results remain the same as the previous two ways.
Convert Time to Minutes in Excel
Formula #1, using multiplication formula
How to convert time to minutes in excel? There are 1,440 minutes in a day, to get the minute number from a TIME value is to multiply it by the number 1440.
The Formula
=A3*1440
The Result
Formula #2, using CONVERT function
Fill the number argument with cell A3
Fill the from_unit argument with “day”
Fill the to_unit argument with “mn”
The Formula
=CONVERT(A3,"day","mn")
The Result
Formula #3, using HOUR, MINUTE and SECOND function
To get the minute number from the hour value multiplied by 60 (number of minutes in one hour) and to get the minute number from the second value divided by 60 (number of seconds in one minute).
The Formula
=(HOUR(A3)*60)+MINUTE(A3)+(SECOND(A3)/60)
The Result
Convert Time to Seconds in Excel
Formula #1, using multiplication formula
How to convert time to seconds in excel? to get the second number from a TIME value is to multiply it by the number 86400 (number of seconds in one day, 24 hours x 60 minutes x 60 seconds).
The Formula
=A3*86400
The Result
Formula #2, using CONVERT function
Fill the number argument with cell A3
Fill the from_unit argument with “day”
Fill the to_unit argument with “sec”
The Formula
=CONVERT(A3,"day","sec")
The Result
Formula #3, using HOUR, MINUTE and SECOND function
To get the second number from the hour value multiplied by 3600 (number of seconds in one hour) and to get the second number from the minute value multiplied by 60 (number of seconds in one minute).
The Formula
=(HOUR(A3)*3600)+(MINUTE(A3)*60)+SECOND(A3)
The Result
Which One the Best Solution?
All depends on you, which solution is the most convenient for you. For me formula #1, the multiplication formula is the simplest. Formula #2 uses one excel function, and the most complex is formula #3 using three excel functions plus multiplication and division formulas.
The choice is yours.
Related Function
Function used in this article
Related Articles
Another articles related to this article
A bit more complicated, but this will work even for minutes >= 1440 or hours >= 24. This doesn’t need any special time formatting for cells either. It avoids the «AM»/»PM» as well.
=QUOTIENT(A1,60)
&":"
&IF(LEN(MOD(A1,60))=1,0,"")
&MOD(A1,60)
Example outputs:
- «5» -> «0:05»
- «20» -> «0:20»
- «60» -> «1:00»
- «740» -> «12:20»
- «1520» -> «25:20»
- «7200» -> «120:00»
Essentially, what we’re doing is first taking the quotient that yields the hour as an integer, and the concatenate that using “&” with the colon “:” and concatenating that with the minutes via the MOD([dividend],[divisor]) function.
The “IF” statement checks using LEN() that if the minutes resulted from MOD() is one digit (length 1) like 0, 1, 2, …, 7, 8, 9, not something like 20, then it will prepend a 0 before the single minute digit, so you won’t have times looking like “3:9”, so it will be “3:09” for 3 hours and 9 minutes.
Alternatively instead of “LEN(MOD())=1” to check for one digit, you can use “MOD()<=9”
It might make more sense to use the length function because whether we prepend 0 is directly based on the length.
How can I convert hours:minutes:seconds
into total minutes in Excel?
Robert
1,2661 gold badge17 silver badges37 bronze badges
asked Jan 22, 2013 at 9:58
Nikhil SurendranNikhil Surendran
9464 gold badges14 silver badges24 bronze badges
Just use the formula
=A8*60*24
answered Jan 22, 2013 at 10:09
3
Just use the formula
120 = (HOUR(A8)*3600+MINUTE(A8)*60+SECOND(A8))/60
wittich
2,0872 gold badges26 silver badges47 bronze badges
answered Jan 22, 2013 at 10:12
Nilesh patelNilesh patel
1,2162 gold badges14 silver badges38 bronze badges
1
The only way is to use a formula or to format cells. The method i will use will be the following:
Add another column next to these values.
Then use the following formula:
=HOUR(A1)*60+MINUTE(A1)+SECOND(A1)/60
answered Jan 22, 2013 at 10:12
John HopleyJohn Hopley
3311 gold badge3 silver badges13 bronze badges
Converting hours and minutes (hh:mm) to minutes in an Excel spreadsheet is actually quite simple, once you know what to do. But I had to do quite a bit of trial and error and Googling to get it to work.
To convert hours and minutes to minutes, you have to multiply the hh:mm value by 1440 (which is 24 [number of hours in the day] multiplied by 60 [number of minutes in an hour]), AND make sure you set the formatting correctly for the both the hh:mm cells and the resulting minute cells. This is where I got caught — I didn’t have the correct formatting applied to the cells. Once I got that right, it all worked.
Here’s how…
- Enter elapsed times in hours and minutes (using the format hh:mm) in Column B. (Yes, those non-stop flights to/from Sydney to Dallas Fort Worth are killers!)
- Set the format for this column to Custom > h:mm. (To format the column, select the column header, right-click on it, select Format Cells, select Custom on the Number tab, then select h:mm from the list of types. Click OK.)
- Insert a new column (C) and called it Minutes.
- Set the format for the cells in this new column to Number with no decimal places — this formatting is critical for the formula to work. (To format the column, select the column header, right-click on it, select Format Cells, select Number on the Number tab, then change the Decimal Places value to 0. Click OK.)
- Put the cursor in the first cell in the new column that pairs with a cell in the hh:mm column. In my example, that was C3, which pairs with B3.
- Type =B3*1440 in the formula bar, then press Enter to convert the hours and minutes into minutes.
- Click in the C3 cell and ‘grab’ the bottom right handle of the cell marker (it turns to a + sign when you’ve grabbed it correctly) and drag it down the other cells in column C. (See below for how to apply it to ALL cells in the column.)
- When you release the mouse, all those cells you dragged this formula over will be converted to minutes and seconds.
To apply this formula to the entire column:
- Copy (Ctrl+C) the result in the first cell with the formula (C3 in my example).
- Select the entire column (column C in my example) by selecting the column header.
- Paste (Ctrl+V).
- You’ll have to rename the column back to Minutes, but you’ll have that formula now applied to every row of your spreadsheet for that column.
These sites helped me figure out what to do:
- http://www.proworkflow.com/blog/2009/02/converting-time-into-minutes-using-excel/
- http://mathforum.org/library/drmath/view/63521.html
See also:
- Convert seconds to minutes: https://cybertext.wordpress.com/2012/04/27/excel-convert-seconds-to-minutes/
[Links last checked August 2017]