Please wait,
Processing your request...

    0%
  Business logo VanSoest.it  
  ... | Selecteer de Nederlandse taal | Print this page. | Linkedin page of Johan van Soest | User: Guest | Login

Postcard image. Click this to mail to Johan

WebHalla
 Content
  Management
   System


ICT-Hotlist Topic

Back to the ICT-Hotlist...
Don't miss the latest updates

How to convert US standard time format to 24 hours (military) format using Excel 2013

Getting those logfiles in an US standard time format using the PM/AM notation and have to present the data correctly sorted? Just convert them using these easy steps in Microsoft Excel 2013. You may also watch the step by step animation.

Step 1

Load your log or text file in Excel using a separator that separates the time from the AM/PM bit. Normally this will be a space character.
2014-07-05 1:25:59 PM "High level sensor 3" Alert
2014-07-05 1:51:23 PM "Normal level sensor 3" Informational
2014-07-05 10:04:46 AM "Switch 7 open" Warning
2014-07-05 10:19:11 AM "Switch 7 closed" Warning
Example log-file using US-Time format. (Notice columns are not aligned.)

Step2

After importing the log file with the import wizzard, your sheet should resemble:
A B C D E
1 2014-07-05 1:25:59 PM High level sensor 3 Alert
2 2014-07-05 1:51:23 PM Normal level sensor 3 Informational
3 2014-07-05 10:04:46 AM Switch 7 open Warning
4 2014-07-05 10:19:11 AM Switch 7 closed Warning

Step 3

Inserting a blank column gives:
A B C D E F
1 2014-07-05 1:25:59 PM High level sensor 3 Alert
2 2014-07-05 1:51:23 PM Normal level sensor 3 Informational
3 2014-07-05 10:04:46 AM Switch 7 open Warning
4 2014-07-05 10:19:11 AM Switch 7 closed Warning
Enter the following formula in cell D1:
=IF(UPPER(C1)="PM";B1+"12:00:00";B1)
Now propagate the formula in the column D*

Step 4

Now you have the following in your Excel sheet:
A B C D E F
1 2014-07-05 1:25:59 PM 0,559710648 High level sensor 3 Alert
2 2014-07-05 1:51:23 PM 0,577349537 Normal level sensor 3 Informational
3 2014-07-05 10:04:46 AM 0,419976852 Switch 7 open Warning
4 2014-07-05 10:19:11 AM 0,429988426 Switch 7 closed Warning

Step 5

Next format Cells in column D as "Time" of "Type" "*13:30:55" This results in:
A B C D E F
1 2014-07-05 1:25:59 PM 13:25:59 High level sensor 3 Alert
2 2014-07-05 1:51:23 PM 13:51:23 Normal level sensor 3 Informational
3 2014-07-05 10:04:46 AM 10:04:46 Switch 7 open Warning
4 2014-07-05 10:19:11 AM 10:19:11 Switch 7 closed Warning
This data can be sorted on date (Column A) and time (Column D)

Example animation

Reload the page to restart the animation.
Animation on how to convert US-Time format to ISO-Time format using Microsoft Office Excel 2013.
Animation on how to convert US-Time format to ISO-Time format using Microsoft Office Excel 2013.
Download the example file here.
You may vote your opinion about this article:


Topic created  :  01-05-2017
Topic last edited  :  01-05-2017

Scripts and programming examples disclaimer

Unless stated otherwise, the script sources and programming examples provided are copyrighted freeware. You may modify them, as long as a reference to the original code and hyperlink to the source page is included in the modified code and documentation. However, it is not allowed to publish (copies of) scripts and programming examples on your own site, blog, vlog, or distribute them on paper or any other medium, without prior written consent.
Many of the techniques used in these scripts, including but not limited to modifying the registry or system files and settings, impose a risk of rendering the Operating System inoperable and loss of data. Make sure you have verified full backups and the associated restore software available before running any script or programming example. Use these scripts and programming examples entirely at your own risk. All liability claims against the author in relation to material or non-material losses caused by the use, misuse or non-use of the information provided, or the use of incorrect or incomplete information, are excluded. All content is subject to change and provided without obligation.
Generated by WebHalla™ Version 0.1.e.2 : Wednesday 16-1-2019 © Copyright 1995-2019 Johan van Soest
Response Form    Cookie- and Privacy statement
Weather in Waalre by OpenWeatherMap logo light intensity drizzle
Temperature 6.37 °C light intensity drizzle
Humidity 87 % light intensity drizzle
Air pressure 1014 hPa light intensity drizzle
Wind speed 7.2 m/s light intensity drizzle
Wind direction South West South West light intensity drizzle