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: Using Excel for Timing.

Using Excel for Timing

Written by Allen Wyatt (last updated August 17, 2021)
This tip applies to Excel 97, 2000, 2002, and 2003


2

You may want to use Excel to record the elapsed time for different events. There are two ways that this can be approached: either native, within Excel, or with a macro.

If you don't want to use a macro, you can easily set up three columns for your timing. The first column can be used to record the start time, the second column the end time, and then the third column the elapsed time (calculated by using a formula that subtracts the start time from the end time). In order to record times, you select a cell in either the start time or end time columns and press Ctrl+: (the colon). Excel enters the current time in that cell.

If you want to use a macro that simply returns the elapsed time, then you can use the following:

Public Sub TimeIt()
    Dim vStartTime As Date

    vStartTime = Time
    MsgBox Prompt:="Press the button to end the timing" & vbCrLf _
      & "Timing started at " & Format(vStartTime, "hh:mm:ss"), _
      Buttons:=vbOKOnly, _
      Title:="Time Recording Macro"
    ActiveCell.Value = Time - vStartTime
End Sub

This macro records a start time (in vStartTime), and then displays a message box. When you click on the message box button, the difference between the current time and the start time is stored in the current cell. (You need to make sure the current cell is formatted with one of the time formats.)

The above macro works very well for recording short events during which you don't need to use Excel for other tasks. If you need to record longer events, then a different approach is in order. The following macros work in tandem. The first one records a start time; that is all it does. The second one uses that recorded time to calculate an elapsed time which is placed in the currently selected cell.

Global vStTime

Sub StartTiming()
    vStTime = Time
End Sub

Sub EndTiming()
    ActiveCell.Value = Time - vStTime
End Sub

You could easily assign these two macros to the Quick Access toolbar or to different toolbar buttons that would, respectively, start and stop the timing process.

Note:

If you would like to know how to use the macros described on this page (or on any other page on the ExcelTips sites), I've prepared a special page that includes helpful information. Click here to open that special page in a new browser tab.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (2037) 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: Using Excel for Timing.

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

Workaround for Multiple Rows of Worksheet Tabs

If you've got a lot of worksheets in your workbook, you may want to display their tabs in to rows at the bottom of the ...

Discover More

Using Search Text in the Replacement

When you use the Find and Replace tool in Word, you may want to include what you searched for in the replacement text. ...

Discover More

Understanding Monospace Fonts

Information in a worksheet needs to be displayed using fonts. If you understand the two different types of fonts ...

Discover More

Solve Real Business Problems Master business modeling and analysis techniques with Excel and transform data into bottom-line results. This hands-on, scenario-focused guide shows you how to use the latest Excel tools to integrate data from multiple tables. Check out Microsoft Excel 2013 Data Analysis and Business Modeling today!

More ExcelTips (menu)

Working with Elapsed Time

Work with times in a worksheet and you will eventually want to start working with elapsed times. Here's an explanation of ...

Discover More

Counting Dates in a Range

Excel makes working with a list of dates relatively easy. If you have a list of dates, you may need to know how many of ...

Discover More

Calculating Business Days

There are calendar days and then there are business days. Excel provides the NETWORKDAYS function that is helpful to ...

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.

Comments

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 seven minus 7?

2017-06-19 05:13:21

Helen

Great tip about the short cut for putting timing on a spreadsheet once I found it should be for me Ctrl. Shift and colon. I run a timesheet and did not realise this shortcut. Thank you.


2012-01-09 06:59:32

Dave Kerr

small typo...

Ctrl+: enters the date in the current cell.

Use Shift+Ctrl+: to enter the time.


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
Subscribe

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.