For instance, given a string like 18:40:59.795Z I'd like to be able to call TOTIME(A1, "HH:MM:SS.mmmZ") or something like that. Time conversion in Excel is a pain; every time I need to do it I have to do string parsing with MID etc. Surely there's a better way?

MacOS preferred.

1 Answer 1


Can I suggest trying XL Wings Python for Excel it allows you to use python as an alternative to VBA and the python datetime functions library will allow you to do exactly what you are looking for with datetime.datetime.strptime() - see here for the format information.

Python for Excel is:

  • Free, Gratis & Open Source
  • Depends on you having an installation of python which is itself free
  • Works on Windows or OS-X
  • Allows you to create User Defined Functions, (UDFs), currently Windows only
  • Can do a lot more for you such as using python to fetch data from a database or the web and format it straight into your workbook.
  • Crap, forgot to mention I'm on a Mac. Good suggestion though, way better than VBA. But I'd be fine with a chunk of VBA code if it did what I wanted...
    – jcollum
    Oct 8, 2016 at 15:43
  • @jcollum - it works on a Mac as well :-) Oct 8, 2016 at 18:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.