Computer >> Computer tutorials >  >> Software >> Office

Build a Real-Time Analog Clock in Excel: Step‑by‑Step Guide

Step 1: Setting up Hours, Minutes, and Seconds

  • Click on cell C5 and enter the following formula:

=IF((HOUR(NOW())+C10/60+C15/3600)>12,(HOUR(NOW())+C10/60+C15/3600)-12,HOUR(NOW())+C10/60+C15/3600)

  • Press Enter.
  • As a result, we will get the value that will control the hours on the clock.

Build a Real-Time Analog Clock in Excel: Step‑by‑Step Guide

  • Enter the Hour Hand Width in cell C6.
  • Choose the C7 cell and enter:
  • We will get the blank space for hours.

Build a Real-Time Analog Clock in Excel: Step‑by‑Step Guide

  • Select cell C10 and enter:
  • Press Enter.
  • We will have the value for the minutes in the clock.

Build a Real-Time Analog Clock in Excel: Step‑by‑Step Guide

  • Enter the Minute Hand Width in cell C11.
  • Choose cell C12 and enter:
  • As a result, we will get blank space for minutes.

Build a Real-Time Analog Clock in Excel: Step‑by‑Step Guide

  • Select cell C15 and enter:
  • Press the Enter button.

Build a Real-Time Analog Clock in Excel: Step‑by‑Step Guide

  • We will have the value to control the seconds.
  • Set the Second Hand Width in cell C16.
  • Choose cell C17 and enter:
  • We will get the value that will control the seconds in the clock.

Build a Real-Time Analog Clock in Excel: Step‑by‑Step Guide

Read More: How to Create Digital Clock in Excel

Step 2: Creating the Clock Frame

  • Go to the Insert tab.
  • Choose the Doughnut Chart from the Insert Pie or Doughnut Chart option.
  • We will have a blank box on the screen.

Build a Real-Time Analog Clock in Excel: Step‑by‑Step Guide

  • Right-click on the box and select Select Data from the available options.
  • A prompt will open on the screen.

Build a Real-Time Analog Clock in Excel: Step‑by‑Step Guide

  • Click on Add in the prompt.

Build a Real-Time Analog Clock in Excel: Step‑by‑Step Guide

  • In the Edit Series prompt, enter the following as the Series values:

={1,1,1,1,1,1,1,1,1,1,1,1}

  • Choose OK.
  • As a result, a data series will be added to the chart, setting the position of the hour.

Build a Real-Time Analog Clock in Excel: Step‑by‑Step Guide

  • Click on Add.

Build a Real-Time Analog Clock in Excel: Step‑by‑Step Guide

  • Enter the same value as the previous one in the Series values. We are doing this for the minute hand.
  • Click OK.
  • This, too, will add another data series to the existing chart.

Build a Real-Time Analog Clock in Excel: Step‑by‑Step Guide

  • Click on Add.

Build a Real-Time Analog Clock in Excel: Step‑by‑Step Guide

  • Enter {1} as the Series value to give shape to the second hand.
  • Choose OK.

Build a Real-Time Analog Clock in Excel: Step‑by‑Step Guide

  • Click OK to exit the Select Data Source prompt.

Build a Real-Time Analog Clock in Excel: Step‑by‑Step Guide

  • A Doughnut chart will be on the screen.
  • Click on the chart.
  • Go to the Format.
  • Set No Outline from the Shape Outline option.

Build a Real-Time Analog Clock in Excel: Step‑by‑Step Guide

  • Turn off the Chart Title and Legend of the chart after clicking on the plus sign at the top-right corner of the chart.

Build a Real-Time Analog Clock in Excel: Step‑by‑Step Guide

  • Choose any of the data series and right-click.
  • From the available options, choose Format Data Series.

Build a Real-Time Analog Clock in Excel: Step‑by‑Step Guide

  • Change the Doughnut Hole Size to 60% from the Format Data Series tab on the right.

Build a Real-Time Analog Clock in Excel: Step‑by‑Step Guide

  • Right-click on the data series 2 from the chart.
  • Select Format Data Series.

 Build a Real-Time Analog Clock in Excel: Step‑by‑Step Guide

  • Set the Angle of the first slice to 15%.

Build a Real-Time Analog Clock in Excel: Step‑by‑Step Guide

  • Turn on the Data Labels for the data series 2.

Build a Real-Time Analog Clock in Excel: Step‑by‑Step Guide

  • Enter 12 in the data label that is at the top middle position.

Build a Real-Time Analog Clock in Excel: Step‑by‑Step Guide

  • Enter the rest of the chart labels as the sequence of an Analog Clock.

Build a Real-Time Analog Clock in Excel: Step‑by‑Step Guide

  • Remove the fill color of the data series 2 by going to the Format tab and clicking No Fill from the Shape Fill option.

Build a Real-Time Analog Clock in Excel: Step‑by‑Step Guide

  • Turn on the data label of the data series 1.

Build a Real-Time Analog Clock in Excel: Step‑by‑Step Guide

  • Choose cell D16.
  • Go to the Insert tab.
  • Select Symbol from the Symbols option.

Build a Real-Time Analog Clock in Excel: Step‑by‑Step Guide

  • In the Symbol prompt, enter 25CF as the Character code.
  • Press Insert.

Build a Real-Time Analog Clock in Excel: Step‑by‑Step Guide

  • As a result, the character will be inserted in the sheet.
  • Copy the character by pressing Ctrl+C.

Build a Real-Time Analog Clock in Excel: Step‑by‑Step Guide

  • Paste the character in the data label of the data series 1 by using Ctrl+V.

Build a Real-Time Analog Clock in Excel: Step‑by‑Step Guide

  • Do the same for the rest of the data labels.

Build a Real-Time Analog Clock in Excel: Step‑by‑Step Guide

  • Turn off the fill color of the data series 1.

Build a Real-Time Analog Clock in Excel: Step‑by‑Step Guide

  • We will have the frame of our Analog Clock.

Build a Real-Time Analog Clock in Excel: Step‑by‑Step Guide

Read More: How to Make a Clock Chart in Excel

Step 3: Inserting Time Hands

  • Choose the C5:C7 cell range.
  • Go to the Insert tab.
  • Choose the Pie Chart from the Insert Pie or Doughnut Chart option.

Build a Real-Time Analog Clock in Excel: Step‑by‑Step Guide

  • We will have a Pie Chart box on the screen.
  • Turn the Chart Title and Legend off for the chart.

Build a Real-Time Analog Clock in Excel: Step‑by‑Step Guide

  • Change the outline of the data series one to No Outline.

Build a Real-Time Analog Clock in Excel: Step‑by‑Step Guide

  • Set the fill color to No Fill.

Build a Real-Time Analog Clock in Excel: Step‑by‑Step Guide

  • Do the same for the data series 1.
  • We will have the portion of the Hour Hand Width.

Build a Real-Time Analog Clock in Excel: Step‑by‑Step Guide

Read More: How to Make a Running Clock in Excel 

Step 4: Aligning the Time Hand

  • Set the fill color of the background of the entire Pie Chart to No Fill.

Build a Real-Time Analog Clock in Excel: Step‑by‑Step Guide

  • Fit the Hour Hand inside the clock by adjusting the size of the Pie Chart.
  • Turn off the Chart Title and Legend of the Doughnut Chart.

Build a Real-Time Analog Clock in Excel: Step‑by‑Step Guide

  • Insert a Pie Chart for the Minute Hand and Second-Hand datasets.
  • Set the color of the hands different from each other.
  • Set the size of the hands so they are different from each other.
  • Adjust them inside the clock.
  • Click on any of the charts and press Ctrl+A.
  • Go to the Shape Format.
  • Choose Align Center from the Align option.

Build a Real-Time Analog Clock in Excel: Step‑by‑Step Guide

  • Go to the Shapes option from the Insert tab.
  • Select an oval shape from the available options.

Build a Real-Time Analog Clock in Excel: Step‑by‑Step Guide

  • Set it at the center of the clock.

Build a Real-Time Analog Clock in Excel: Step‑by‑Step Guide

Read More: How to Use VBA Code for Creating Digital Clock in Excel

Step 5: Applying VBA Code for Starting and Stopping the Clock

  • Go to the Developer tab.
  • Choose Visual Basic.
  • A new window will be opened.

Build a Real-Time Analog Clock in Excel: Step‑by‑Step Guide

  • In the Visual Basic window, choose ThisWorkbook under the VBAProject option.
  • A coding module will appear.

Build a Real-Time Analog Clock in Excel: Step‑by‑Step Guide

  • In the module, enter the following code and save it:
Sub StartClock()
Dim am_ws As Worksheet
Set am_ws = ActiveSheet
am_ws.Range("H5").Value = "Start"
x:
VBA.DoEvents
If am_ws.Range("H5").Value = "Stop" Then Exit Sub
Application.Calculate
GoTo x
End Sub
Sub StopClock()
Dim am_ws As Worksheet
Set am_ws = ActiveSheet
am_ws.Range("H5").Value = "Stop"
End Sub

Build a Real-Time Analog Clock in Excel: Step‑by‑Step Guide

  • Go to the Insert tab.
  • Select a rectangle shape from the Shapes option.

Build a Real-Time Analog Clock in Excel: Step‑by‑Step Guide

  • Enter the shape below the clock and name it Start.
  • Repeat the same process to insert a Stop box.

Build a Real-Time Analog Clock in Excel: Step‑by‑Step Guide

  • Right-click on the Start button.
  • From the available options, select Assign Macro.

Build a Real-Time Analog Clock in Excel: Step‑by‑Step Guide

  • Assign the StartClock macro to the button.
  • Finally, click OK.

Build a Real-Time Analog Clock in Excel: Step‑by‑Step Guide

  • Again, right-click on the Stop button.
  • From the prevailing options, select Assign Macro.

Build a Real-Time Analog Clock in Excel: Step‑by‑Step Guide

  • Assign the StopClock macro to that button.

Build a Real-Time Analog Clock in Excel: Step‑by‑Step Guide

  • Click the Start button to start the clock and the Stop button to stop the code.

Build a Real-Time Analog Clock in Excel: Step‑by‑Step Guide

Download the Practice Workbook

You can download the practice workbook here.

Related Article

  • Excel VBA Digital Clock on UserForm: A Comprehensive Guide
Get FREE Advanced Excel Exercises with Solutions!