# Lap Timer and Running Average

#### Josh96

##### New Member
Hi there!

I'm trying to set up a lap timer in Excel, with the ability to do up to 100 laps. I've seen things like this are possible, but haven't found a useful source which explains to me how to do it. If anyone can point me in the direction of a good tutorial or something it'd be much appreciated!

However, I also want to be able to keep track of the average of the 10 most recent lap times. Is there a neat way to get Excel to be able to do this for me, or will I be stuck with having to do this manually?

### Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN

#### rpaulson

##### Well-known Member
try this on a blank file

Code:
``````Option Explicit
Private startTime As Single

Sub StartButton_Click()
Range("A:B").ClearContents
Range("A1") = "Start"
startTime = Timer
End Sub
Sub LapButton_Click()
Dim finalTime As Single, lr As Long
finalTime = Timer - startTime
lr = Cells(Rows.Count, "A").End(xlUp).Row + 1
Cells(lr, "A") = Format(finalTime, "0.000")
If lr = 2 Then Cells(lr, "B") = Cells(lr, "A")
If lr > 2 Then Cells(lr, "B") = Cells(lr, "A") - Cells(lr - 1, "A")
End Sub``````

create 2 buttons
start button - will erase your data in column A & B the time to start over
lap button - will write the time in column A since the start button was pressed and in column B it will write the lap time

hth,

Ross

Last edited:

Replies
2
Views
123
Replies
8
Views
125
Replies
6
Views
306
Replies
1
Views
204
Replies
6
Views
71

1,191,077
Messages
5,984,503
Members
439,894
Latest member
Amba1006

### We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

### Which adblocker are you using?

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

### Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

### Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

### Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back