Please wait,
Processing your request...

    0%
  Business logo VanSoest.it
  ... | Selecteer de Nederlandse taal |
Sharing is caring
| Print this page. | Linkedin page of Johan van Soest

React: Postcard image. Click this to mail to Johan

WebHalla
 Content
  Management
   System

ICT-Hotlist Topic

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:


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.7 : Friday 29-3-2024 © Copyright 1995-2024 ing. Johan P.G. van Soest CIPM Certified Privacy Information Manager
Response Form    Cookie- and Privacy statement    Responsible Disclosure procedure
Weather in Waalre by OpenWeatherMap logo overcast clouds
Temperature 9.17 °C overcast clouds
Wind chill 6.31 °C overcast clouds
Humidity 65 % overcast clouds
Air pressure 988 hPa overcast clouds
Wind speed 5.66 m/s overcast clouds
Wind direction South South overcast clouds
Sun Rise 6:19 Sun Rise
Sun Set 19:05 Sun Set
Updated:2024-03-29 00:55:05 overcast clouds
| Current user: Guest | Login |