# How to use the SECOND function

**What is the SECOND function?**

The SECOND function returns an integer representing the second based on an Excel time value. The returning number ranges from 0 to 59.

## 1. Introduction

**What is an integer?**

An integer is a whole number that can be positive, negative, or zero, but not a fraction or decimal. Excel can't calculate the second based on a negative Excel time value.

**What is an Excel time value**

Excel time* *is actually a decimal number ranging between 0 and 1 in Excel and then formatted as time.

For example, 12:00 PM is represented as 0.5 because it is half of a day, you can verify this by typing 12:00 PM in a cell and then change the cell formatting to general. This will show the value as Excel interprets it.

**How does Excel recognize time values?**

Excel recognizes certain text strings like "6:45 PM" as valid time values. A recognized time value is right aligned in the cell just like a regular number, shown in the image below in cell B2.

A time number that is not recognized is left aligned which is demonstrated in cell B4 in the image above. This visual feedback lets you easily spot values that need closer inspection.

**What is a second in an Excel time value?**

There are 60 minutes in one hour and 24 hours in one day. 60 * 24 = 1440 minutes in one day. There are 60 seconds in one minute, an entire day contains 60 * 1440 = 86,400 seconds.

1/86400 or approx. 0.0000115740740740741 represents one second in Excel time value. Excel uses a number 0 <= x <= 1 in decimal form to represent time in an Excel worksheet. 0 is zero minutes and 1 is 86400 seconds (24 hours).

**Why is 1 equal to 86,400 seconds?**

This has to do how Excel handles dates. Each date is represented by an integer and one day is equal to 1 in Excel. There are 24 hours, or 1440 minutes, or 86,400 seconds in one day.

Dates are stored numerically but formatted to display in human-readable date/time formats, this enables Excel to do work with dates in calculations.

For example, dates are stored as sequential serial numbers with 1 being January 1, 1900 by default. The integer part (whole number) represents the date the decimal part represents the time.

This allows dates to easily be formatted to display in many date/time formats like mm/dd/yyyy, dd/mm/yyyy and so on and still be part of calculations as long as the date is stored numerically in a cell.

You can try this yourself, type 10000 in a cell, press CTRL + 1 and change the cell's formatting to date, press with left mouse button on OK. The cell now shows 5/18/1927.

## 2. Syntax

SECOND(*serial_number*)

serial_number |
Required. An Excel time value that you want to extract the second from. |

## 3. Example 1

The formula used in cells C3:C7 is the SECOND function. This function extracts the seconds from a given **time** value or **date and time** value.

Formula in cell C3:

This extracts the seconds from the time 1:34:22 PM, which is 22 seconds.

Formula in cell C4:

This extracts the seconds from the time 1:53:05 PM, which is 5 seconds.

Formula in cell C5:

This extracts the seconds from the time 10:45:35 AM, which is 35 seconds.

Formula in cell C6:

This extracts the seconds from the time 5:25:15 PM, which is 15 seconds.

Formula in cell C7:

This extracts the seconds from the time 12:16:22 AM, which is 22 seconds.

The SECOND function ignores the hours and minutes of the time value and focuses solely on the seconds component. It's useful when you need to isolate and work with just the seconds part of a time value in Excel.

## 4. Example 2

**A car starts driving at 12:05:23 PM and arrives at the destination at 1:10:48 PM. How many seconds did the journey take?**

What we know:

- Start time: 12:05:23 PM
- End time: 1:10:48 PM
- Excel time values are decimal values between 0 (zero) and 1. This allows us to perform calculations to Excel time values.

In Excel, one day represents a value of 1. Since a day contains 24 hours, one hour is represented as 1/24 of a day. One minute is 1/(24*60) of a day, as there are 60 minutes in an hour and 24 hours in a day. One second is 1/(24**60**60) of a day, as there are 60 seconds in a minute, 60 minutes in an hour, and 24 hours in a day.

Formula in cell C5:

This formula calculates the difference between the time value in cell C3 and B3. This value is displayed in hours, minutes, and seconds, however, it is possible to format the output value to show only seconds even if it is larger than 59 which is the default limit.

This is done by applying cell formatting to cell C5 using this custom format code: [s] This can be easily accomplished by applying cell formatting.

- Select cell C5.
- Press CTRL + 1 to open the "Format cells" dialog box. The image above shows this dialog box below the formula.
- Select Category: Custom
- Type [s] in the Type: field
- Press the OK button to apply changes.

The image above demonstrates an alternative way to calculate the number of seconds without using cell formatting. Note that the SECOND function is not used at all, it is limited to 59 seconds the most. It can show values equal to 60 or more.

Formula in cell C5:

Here's how it works:

- (C3-B3) - This calculates the time difference between the arrival and departure times. The result will be in the format of a decimal number representing the number of days.
- 60*60*24 - This converts the decimal number of days into seconds.
- Multiplying by 60 converts the decimal number of days into hours.
- Multiplying by 60 again converts the hours into minutes.
- Multiplying by 24 converts the minutes into seconds.

In this specific case, the car started driving at 12:05:23 PM and arrived at the destination at 1:10:48 PM. The formula calculates the time difference between these two times, which is 1 hour, 5 minutes, and 25 seconds. Converted to seconds, this is 3,925 seconds.

### Comments

Excel time (*serial_number) *is actually a number ranging between 0 and 1 in Excel and then formatted as time.

Example, 12:00 PM is represented as 0.5 because it is half of a day, you can verify this by typing 12:00 PM in a cell and then change the cell formatting to general.

This will show the value as Excel interprets it.

### 'SECOND' function examples

Table of Contents How to use the NETWORKDAYS function How to use the NETWORKDAYS.INTL function How to use the NOW […]

### Functions in 'Date and Time' category

The SECOND function function is one of 22 functions in the 'Date and Time' category.

## How to comment

How to add a formula to your comment<code>Insert your formula here.</code>

Convert less than and larger than signsUse html character entities instead of less than and larger than signs.

< becomes < and > becomes >

How to add VBA code to your comment[vb 1="vbnet" language=","]

Put your VBA code here.

[/vb]

How to add a picture to your comment:Upload picture to postimage.org or imgur

Paste image link to your comment.

Contact OscarYou can contact me through this contact form