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: Calculating TV Time.

Calculating TV Time

by Allen Wyatt
(last updated June 28, 2014)

John works in the TV industry, where timing is done to a resolution finer than a second. Television video must take into account hours, minutes, seconds, and frames. (There are thirty frames per second.) John was wondering if there was a way to handle frames in Excel.

There is no way to handle frames as part of the native time values in Excel. There are, however, a couple of things you can do to work with frames. Perhaps the most obvious suggestion is to keep hours, minutes and seconds as a regular time value, and then put frames in a separate cell. The immediate drawback to this approach is that calculations for the "TV times" are not as easy as they would be if they were represented in a single value.

A way around this is to try to do your own calculations in a macro. Excel goes through an internal process of converting times to decimal values that can be worked with very easily. You could simulate this same conversion process, converting a time value (including frames) to a decimal value. The TV time, in the format 00:29:10:10, could be stored in a cell (where Excel will treat it as a string) and then converted to a value by the macro.

There is a problem here, of course: You cannot convert the time to a true decimal value between 0 and 1 like Excel does for times. The reason has to do with the limits on Excel's significant digits. To arrive at a value, you would divide the hours by 24, the minutes by 1440 (24 * 60), the seconds by 86400 (24 * 60 * 60) and the frames by 2592000 (24 * 60 * 60 * 30). When you start getting into values that small, it exceeds Excel's limits of maintaining everything to fifteen significant digits. Thus, you end up with unavoidable rounding errors on the frames value.

One solution to this problem is to not try to work with decimal values between 0 and 1, but instead work with integers. If you convert the string time into an integer value that represents the number of total frames in the time, then you can easily do math on the resulting value. The following macro will do the conversion of a string in the format already mentioned:

Function Time2Num(Raw) As Long
    Dim FirstColon As Integer
    Dim SecondColon As Integer
    Dim ThirdColon As Integer
    Dim NumHours As Integer
    Dim NumMinutes As Integer
    Dim NumSeconds As Integer
    Dim NumFrames As Integer
    Dim T2D As Long

    FirstColon = InStr(Raw, ":")
    SecondColon = InStr(FirstColon + 1, Raw, ":")
    ThirdColon = InStr(SecondColon + 1, Raw, ":")

    NumHours = Val(Mid(Raw, 1, FirstColon - 1))
    NumMinutes = Val(Mid(Raw, FirstColon + 1, SecondColon - 1))
    NumSeconds = Val(Mid(Raw, SecondColon + 1, ThirdColon - 1))
    NumFrames = Val(Mid(Raw, ThirdColon + 1, Len(Raw)))

    T2D = CLng(NumHours)
    T2D = T2D * 60 + NumMinutes
    T2D = T2D * 60 + NumSeconds
    T2D = T2D * 30 + NumFrames

    Time2Num = T2D
End Function

To see how this works, if you have a string such as 37:15:42:06 in cell A4, and you use the formula =Time2Num(A4), the result is the value 4024266, which is the number of frames in 37 hours, 15 minutes, 42 second, and 6 frames. To convert such values back to an understandable time, you can use the following function:

Function Num2Time(Raw) As String
    Dim NumHours As Integer
    Dim NumMinutes As Integer
    Dim NumSeconds As Integer
    Dim NumFrames As Integer
    Dim RemainingTime As Long


    NumHours = Raw \ (CLng(30 * 60) * 60)
    RemainingTime = Raw Mod (CLng(30 * 60) * 60)

    NumMinutes = RemainingTime \ (60 * 30)
    RemainingTime = RemainingTime Mod (60 * 30)

    NumSeconds = RemainingTime \ 30
    RemainingTime = RemainingTime Mod 30

    NumFrames = RemainingTime

    Num2Time = Format(NumHours, "00") & ":" & _
      Format(NumMinutes, "00") & ":" & _
      Format(NumSeconds, "00") & ":" & _
      Format(NumFrames, "00")
End Function

By combining the two functions, you can do some math with the times. For instance, suppose you had the time 00:29:10:10 in cell A4 and the time 00:16:12:23 in cell A5. If you put the following formula in a cell, you can find out the difference between the two times:


The result is 00:12:57:17.

The examples presented here are rudimentary; they don't take into account any error handling or limit checking on the times used. You can either expand on the examples to fit your needs, or you can look to a third-party source. For instance, you can find an explanation (with a sample workbook) for NTSC and PAL times at the following URL:

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (3100) 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: Calculating TV Time.

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. ...


Speeding Up Cursor Movement

If you use the arrow keys to move the insertion point through the document, you may have noticed that it can be slow going at ...

Discover More

Speeding Up Large Worksheets

If your worksheet gets large enough, you may notice a severe slowdown when it is recalculated. This tip provides some ...

Discover More

Permanent Watermarks in a Document

Need to add a graphic watermark to a document? It's not that hard to do, but making the watermark permanent can be a bit more ...

Discover More

Excel Smarts for Beginners! Featuring the friendly and trusted For Dummies style, this popular guide shows beginners how to get up and running with Excel while also helping more experienced users get comfortable with the newest features. Check out Excel 2013 For Dummies today!

More ExcelTips (menu)

How Excel Stores Dates and Times

Excel stores dates and times internally using what is called a serial number. This tip explains how that serial number is ...

Discover More

Determining the Day of the Month

Want to figure out the day of the month represented by a particular date? You can use the Day function in VBA to get the ...

Discover More

Finding the Previous Work Day

Excel has a number of functions that are available as an add-on in the Analysis ToolPak. One of these functions allows you to ...

Discover More

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}] 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 6 + 0?

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.

Newest Tips

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

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.