Archive for March, 2011

G Challenge III – Practice Excel VBA Interview question – Watch face maths

I have heard of this question coming up a little bit in all sorts of technical interviews so I thought I would set it as a G Challenge.


“Please tell me what you would implement to tell me the angle between then hands on a watch face at any given time of the day.  Please show your working and use these examples.”

6:00, 3:00, (lets make this non trivial now ) 9:15, 1:30 12:50,  3:20.

Answer Style:

It is up to you how you go about answering this, but I would try this in two stages. 

  1. Have a pen and paper and go about it as if you were in an interview, then :
  2. Actually try to write some VBA for a spreadsheet that goes about doing it.  Esp if you can call it from the sheet so your function returns the answer from an Excel Date Time entered in a cell.

Extra Homework:

  • Could you write this as a VB dll, C++ dll, C# XLL etc?
  • Does your function cope with 24hr time format?
  • Can you also output a list of times from an angle?  Ie. what times equate to 90 deg, 27 deg etc? 
    • If so can you output this as an array function so that a list can be shown in Excel?

Watch Accuracy Tracker

I had an idea the other day that I would write a small app in Excel to keep track of all my watches.

I was planning to use a constant source like :

to keep track of the ‘real’ time and then have an ability to take a ‘snapshot’ of what the time is on each watch in a list ( that can be added to of course). This way using the inbuilt goodies of Excel all manner of graphs and stats can be applied to the raw data and people can see how their watch is behaving.

I was also thinking of adding a few features like resting orientation to see if any of the theories about leaving the watch 3 down, 9 down , dial up, dial down do influence the readings. Along with whether the chrono is running, is it being worn during the timing period etc.

Would anyone be interested in a copy of this? If anyone has any ideas / suggestions that would be great.

I am also thinking of using this as a quide too :

Categories: Uncategorized