# Microsoft Excel HOUR, MINUTE, SECOND Function Tutorial

Since 1998 Excel Function Tutorial  The HOUR, MINUTE and SECOND functions are designed to take an Excel serial date/time number and convert it to an hour, minute or second number representation. Of great use when building dashboards or worksheet tables that will be used in PivotTables.

## What are the Microsoft Excel HOUR, MINUTE and SECOND Functions?

The Excel HOUR, MINUTE and SECOND functions are computer programs that you run from a worksheet cell formula. They convert an Excel serial date number like 42005.5 in to an hour number range from 0-23, a minute number range from 0-59 and a second format like 0-59. You run these functions by typing their names in a formula then followed by the information they are suppose to use. These worksheet functions are used when you have to tear a date/time apart by its hour, minute and second number components. Their components are then used for tasks like logic, lookups, mathematical operations like + and -,  and table construction so the tables can be filtered with Excel's data tools like PivotTables, Sort and AutoFilter.

## How Do You Type the HOUR, MINUTE and SECOND Worksheet Functions in a Formula?

Whenever you type a formula in a worksheet cell, this is called syntax or grammar. The general function syntax for these functions has a format like these when you type them in a worksheet cell:

= HOUR( serial_number )

= MINUTE( serial_number )

= SECOND( serial_number )

Where serial_number is called the function argument list. Remember, you are running a computer program at this point so the program needs information to operate and that is why there is an argument list. When you see an argument list and you see square brackets [ ] around the argument name, this means the argument is optional and you do not have to include it when typing unless you need it. So for the syntax above, you need to include 1 argument when typing the functions in a worksheet cell formula in order for it to calculate correctly. What argument values can be used are discussed below. Remember functions expect certain things in their argument lists, if you do not put the correct information in the list they will generate an error when run.

## HOUR, MINUTE and SECOND Worksheet Function Argument Definitions

• serial_number: Required. This is the date/time from which you want the hour, minute or second. This value can be a date entered in a cell or calculated by some function that returns a serial datetime number. For example, you can use TIME( 8, 24, 59 ) or TIMEVALUE( "8:24:59 AM" ) or something like 8:24:59 AM typed in a cell. It cannot, however, be text.
• Microsoft Excel stores dates/times on a worksheet as sequential serial decimal numbers so they can be used in worksheet formula calculations. So therefore January 1, 1900 12:00:00 PM is serial number 1.5 and June 30, 2015 6:00:00 PM is serial number 42185.75 because it is 42,185.75 days after January 1, 1900. Microsoft Excel for the Macintosh uses a different date system by default.

## How Do You Run the HOUR, MINUTE and SECOND Functions?

Since the HOUR, MINUTE and SECOND functions are computer programs, they run when you press Enter to enter the formula that contains them. If any of their arguments are wrong, the functions will return an error.

## What Do I Type for a HOUR, MINUTE and SECOND Function Argument?

When typing the HOUR, MINUTE and SECOND functions in a worksheet cell formula, you need to replace the serial_number argument with something that generates the serial number needed. Some typical arguments you can use are:

 Argument Type Cell Formula Example Explanation Cell Reference = HOUR( A1 ) Returns the hour number based upon what serial date/time number is in cell A1. For example if 8/24/2015 6:00:00 AM was in cell A1 then 6 would be returned Range Reference = MINUTE( A1:A10 ) Returns an array of minute numbers based upon the dates in cells A1 to A10 Nested Functions = SECOND( TIMEVALUE( "8:24:59 AM" ) ) Returns a second number based upon the decimal value returned from the TIMEVALUE function. Very common argument type for dashboard problems and from data stored in multiple columns

## Additional HOUR, MINUTE and SECOND Function Examples

The worksheet seen below contains some typical worksheet formulas that run the HOUR worksheet function. Pay close attention to the argument list and the syntax used to write the formula.

 A B C 1 Time 2 1/1/2015 8:05:59 AM 3 4 Formula below uses the HOUR function to obtain the hour from the date/time above, then VLOOKUP uses it to lookup an hour in another table. Typical use in a VLOOKUP formula 5 = VLOOKUP( HOUR( A2 ), \$G\$1:\$K\$100, 3, FALSE )  Need Help? Please call us at 1.805.498.7162

Microsoft Excel Products

- Excel Self-Study Manuals