Please Note: This article is written for users of the following Microsoft Excel versions: 97, 2000, 2002, and 2003. If you are using a later version (Excel 2007 or later), this tip may not work for you. For a version of this tip written specifically for later versions of Excel, click here: Dealing with Large Numbers of Seconds.

# Dealing with Large Numbers of Seconds

Written by Allen Wyatt (last updated July 22, 2023)
This tip applies to Excel 97, 2000, 2002, and 2003

Piers has a report which runs and once it is complete he logs the start time and duration, in seconds. If A1 is the start time and B1 is the number of seconds, Piers uses the following formula to determine the ending time:

```=A1+TIME(0,0,B1)
```

The formula works fine, unless report execution took over 32,767 seconds, which often happens. Piers wonders what formula he can use to get past this apparent Excel limitation.

First, it is important to understand that what you have discovered is, indeed, a limitation of Excel. Or, more precisely, a limitation of the TIME function. The three parameters you use in the function (representing hours, minutes, and seconds) must be integer values. That is "programming speak" for the fact that each value must be in the range of 0 to 32767. Outside that range, and you get an error.

One solution is to simply make sure that you don't use a value that is outside of this range. I like this recasting of the formula, still using the TIME function:

```=A1+TIME(INT(B1/3600),0,MOD(B1,3600))
```

Whereas the limit in your original formula meant that you could not have a report run for much more than 9 hours (32767 seconds), this revised formula will handle durations of nearly 4 years. (If you have reports that are taking more than 4 years to run, something is probably wrong!)

Of course, you could bypass using the TIME function altogether and simply come up with your own formula to add the seconds to the value in A1. This is easier than it may seem; all you need to do is remember that time values are stored, within Excel, as fractions of a day. Since there are 86,400 seconds in each day (60 seconds * 60 minutes * 24 hours), you could use this formula:

```=A1+B1/86400
```

Just make sure that the cell containing the formula is formatted to display times, and you'll have no problem. (Just format the cell the same way that cell A1 is formatted; you can use the Format Painter to do this.)

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (9419) applies to Microsoft Excel 97, 2000, 2002, and 2003. You can find a version of this tip for the ribbon interface of Excel (Excel 2007 and later) here: Dealing with Large Numbers of Seconds.

##### Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company. ...

##### MORE FROM ALLEN

Formatting an ASCII Table with Spaces

When you get a text file from a program other than Word, tabular information may be formatted with nothing but spaces in ...

Discover More

Backing Up Your Custom Dictionaries

When you work with the spelling checker quite a bit, you eventually end up with a sizeable custom dictionary. You might ...

Discover More

Getting Rid of the "Enable Macros" Notice

Do you get tired of the dialog box that says "do you want to enable macros" that is displayed when you open a workbook. ...

Discover More

Create Custom Apps with VBA! Discover how to extend the capabilities of Office 2013 (Word, Excel, PowerPoint, Outlook, and Access) with VBA programming, using it for writing macros, automating Office applications, and creating custom applications. Check out Mastering VBA for Office 2013 today!

##### More ExcelTips (menu)

Counting Times within a Range

Excel allows you to easily store dates and times in your worksheets. If you have a range of cells that contain times and ...

Discover More

Calculating Elapsed Time with Excluded Periods

When using Excel to calculate elapsed time, there can be all sorts of criteria that affect the formulas you would ...

Discover More

Checking for Time Input

Need to know if a cell contains a time value? Excel doesn't contain an intrinsic worksheet function to answer the ...

Discover More
##### Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] (all 7 characters, in the sequence shown) in your comment text. Youâ€™ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is 8 - 7?

There are currently no comments for this tip. (Be the first to leave your commentâ€”just use the simple form above!)

##### This Site

Got a version of Excel that uses the menu interface (Excel 97, Excel 2000, Excel 2002, or Excel 2003)? This site is for you! If you use a later version of Excel, visit our ExcelTips site focusing on the ribbon interface.