The Excel SECOND function is a Date & Time formula that parses and returns the second value from a time value. The return value is an integer, ranging from 0 to 59. The outcome of this function resets for every 60 seconds of input. In this guide, we’re going to show you how to use the Excel SECOND function and also throw in some tips and error handling methods.
- All Excel versions
Excel SECOND Function Syntax
|serial_number||The time value for which you want to find the second value. You can use a text string like "8:30", or a decimal number like 0.24125 which means 5:47:24 AM in Excel.|
The SECOND function only needs a single argument to execute: serial_number. Although the argument parameter contains "number" in its name, Excel can evaluate time values included in a string as well. Simply enter the serial_number as a static value, a cell reference, or a return value from a function that can generate a time value. Functions such as TIME and TIMEVALUE can be used for this purpose.
=SECOND(0.256) returns 38
=SECOND(TIMEVALUE("21:36:107")) returns 47 because the function resets the second value after 60.
- Excel stores date and time as numbers. Excel assumes that the date 1/1/1900 is “1″, and increases this number by 1 for each day. In a similar way, the time values must be between 0 and 999999999. For example; 6:00 AM is equal to 0.25. Because of this, the TIMEVALUE function in Excel returns a number that is displayed as a time value.
- A time value in Excel is 0 on 12:00 AM.
- VBA also has a function that shares same name. The usage of that function is also very similar to its Excel counterpart.
Dim MyTime, MySecond MyTime = #4:35:17 PM# ' Assign a time. MySecond = Second(MyTime) ' MySecond contains 17.
- The SECOND function returns #NUM! error, if the serial_number entered is negative or too big.