+ Reply to Thread
Results 1 to 5 of 5

Convert a string of time to military time string

  1. #1
    Registered User
    Join Date
    02-21-2018
    Location
    Sydney, Australia
    MS-Off Ver
    MS Office 2017
    Posts
    1

    Convert a string of time to military time string

    Hi all,

    I have a series of data in format like 01 to 02 PM, 03 to 04 AM, etc. And I want to convert it to format like 1300-1400, 1500-1600. It's a pain to search and replace for each time frame.

    excel sample.png

    Any help would be appreciated! Thx a bunch!

  2. #2
    Forum Expert ben_hensel's Avatar
    Join Date
    01-26-2012
    Location
    Northeast USA
    MS-Off Ver
    Office 365
    Posts
    2,043

    Re: Convert a string of time to military time string

    Consider the third vs. fourth terms:
    "11 to 12 PM" to "1100-1200"
    "01 to 02 PM" to "1300-1400"

    How does the formula know that it's 1 PM and not 1 AM in the fourth term there?

    I mean it's going to be something like:
    Please Login or Register  to view this content.
    But I think we need some kind of logic right after that LEFT (a second IF?) to handle the ambiguity I'm seeing there.
    Click the [* Add Reputation] Button to thank people for help!
    Post Attachment: Click [Go Advanced] under the reply box; then click [Manage Attachments] to launch the attachments dialogue.
    Mark Thread Solved: Go to the top of the first post; Select [Thread Tools] dropdown; Pick the [Mark thread as Solved] option.

  3. #3
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,010

    Re: Convert a string of time to military time string

    .
    https://www.extendoffice.com/documen...o-24-hour.html

    Look about 1/4 way down the page. Convert 12 Hour to 24 Hour

  4. #4
    Forum Expert kersplash's Avatar
    Join Date
    11-22-2016
    Location
    Perth
    MS-Off Ver
    Home 2016 (Windows 10)/Work 2013 Pro Plus (Windows 10)
    Posts
    2,012

    Re: Convert a string of time to military time string

    Are you going to want to use these in future calculations? If so I would be putting the start and stop times in separate cells.

    Also, are they always single hours between the start and stop?

  5. #5
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: Convert a string of time to military time string

    Attach a representative sample workbook (not a picture or text). Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Automatically entering : when I type a string of 4 numbers military time format.
    By ibeesda1Udontknow2 in forum Hello..Introduce yourself
    Replies: 1
    Last Post: 01-19-2013, 12:56 AM
  2. [SOLVED] Function to convert Time String to Time
    By Mangesh Yadav in forum Excel Formulas & Functions
    Replies: 30
    Last Post: 09-06-2005, 05:05 PM
  3. [SOLVED] Function to convert Time String to Time
    By Andibevan in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 04:05 PM
  4. [SOLVED] Function to convert Time String to Time
    By Andibevan in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 02:05 PM
  5. [SOLVED] Function to convert Time String to Time
    By Andibevan in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 12:05 PM
  6. [SOLVED] Function to convert Time String to Time
    By Mangesh Yadav in forum Excel Formulas & Functions
    Replies: 12
    Last Post: 09-06-2005, 06:05 AM
  7. Function to convert Time String to Time
    By Mangesh Yadav in forum Excel Formulas & Functions
    Replies: 18
    Last Post: 09-06-2005, 04:05 AM
  8. [SOLVED] Function to convert Time String to Time
    By Andibevan in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-05-2005, 11:05 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1