ExcelFunctions.net

Search Site:

Related Page:

Seconds To Time In ExcelThe following examples convert a time to a decimal (i.e. to a number of hours, minutes or seconds) using two different methods.

The following spreadsheets show two different formulas that can be used to convert a time to a number of hours in Excel.

The simplest formula to convert a time to a number of hours is shown below. In this case, the time is simply multiplied by 24 (the number of hours in one day).

A | B | |
---|---|---|

1 | Time (hh:mm:ss) | Hours (decimal) |

2 | 02:30:00 | =A2 * 24 |

The formula in cell B2 of the above spreadsheet returns the value *2.5*.

I.e. 2 hours 30 minutes and 0 seconds is equal to *2.5* hours.

*(The reason that this method works is because Excel times are internally stored as decimal values, with the value 1.0 used to represent 24 hours, and therefore, the value 1/24 used to represent 1 hour).*

The second formula that can be used to provide the same result uses the Excel Hour, Minute, and Second functions. Although this formula is much longer than the simple multiplication shown above, some people prefer it.

A | B | |
---|---|---|

1 | Time (hh:mm:ss) | Hours (decimal) |

2 | 02:30:00 | =HOUR(A2) + MINUTE(A2) / 60 + SECOND(A2) / 3600 |

Again, the formula in cell B2 of the above spreadsheet returns the value *2.5*.

Cell B2 of the spreadsheets below show the two formulas that can be used to convert a time to a number of minutes in Excel.

The simplest way to convert a time to a number of minutes is to multiply the time by 1440, which is the the number of minutes in one day:

A | B | |
---|---|---|

1 | Time (hh:mm:ss) | Minutes (decimal) |

2 | 02:30:30 | =A2 * 1440 |

For the time 02:30:30, the formula in cell B2 of the above spreadsheet returns the value *150.5*.

I.e. 2 hours 30 minutes and 30 seconds is equal to *150.5* minutes.

*(The reason that this method works is because Excel times are internally stored as decimal values, with the value 1.0 used to represent 24 hours, and therefore, the value 1/1440 used to represent 1 minute).*

The same result can also be obtained using the Excel Hour, Minute and Second functions, as shown in the spreadsheet below:

A | B | |
---|---|---|

1 | Time (hh:mm:ss) | Minutes (decimal) |

2 | 02:30:30 | =HOUR(A2) * 60 + MINUTE(A2) + SECOND(A2) / 60 |

Again, the formula in cell B2 of the above spreadsheet returns the value *150.5*.

The spreadsheets below show the formulas that can be used to convert a time to a number of seconds in Excel.

The easiest way to convert a time to a number of seconds is to simply multiply the time by 86400, which is the the number of seconds in one day:

A | B | |
---|---|---|

1 | Time (hh:mm:ss) | Seconds (decimal) |

2 | 02:30:30 | =A2 * 86400 |

For the time 02:30:30, the formula in B2 of the above spreadsheet returns the value *9030*.

I.e. 2 hours 30 minutes and 30 seconds is equal to *9030* seconds.

*(The reason that this method works is because Excel times are internally stored as decimal values, with the value 1.0 used to represent 24 hours, and therefore, the value 1/86400 used to represent 1 second).*

The same result can be obtained using the Excel Hour, Minute and Second functions, as shown below:

A | B | |
---|---|---|

1 | Time (hh:mm:ss) | Seconds (decimal) |

2 | 02:30:30 | =HOUR(A2) * 3600 + MINUTE(A2) * 60 + SECOND(A2) |

Again, the formula in B2 of the above spreadsheet returns the value *9030*.

When you convert a time to a decimal, the cell containing the result may have the wrong formatting (e.g. the result may be displayed as a time, instead of a decimal).

In this case, you will need to format the cell to have the Excel 'General' format. To do this you can use either of the following two methods:

The easiest way to change cell formatting to the 'General' format is to select the cell(s) to be formatted and then select the **General** option from the drop-down menu in the ribbon. This is found in the 'Number' group on the **Home** tab (see below):

This method can be used in all versions of Excel, including earlier versions that do not have the ribbon:

- Right click on the cell(s) to be formatted;
- Select the option
to display the 'Format Cells' dialog box;__F__ormat Cells... - Ensure the
**Number**tab of the dialog box is selected; - From the
list, select the option__C__ategory:**General**and click**OK**.