{"id":8742,"date":"2022-01-13T16:19:25","date_gmt":"2022-01-13T16:19:25","guid":{"rendered":"https:\/\/officetuts.net\/excel\/?p=8742"},"modified":"2024-02-19T14:52:27","modified_gmt":"2024-02-19T14:52:27","slug":"convert-time-string-to-time","status":"publish","type":"post","link":"https:\/\/officetuts.net\/excel\/formulas\/convert-time-string-to-time\/","title":{"rendered":"How to Convert Time String to Time in Excel"},"content":{"rendered":"\n
Convert-Time-String-to-Time<\/a>Download File<\/a><\/div>\n\n\n\n

A lot of times, people are giving up on Excel because they have problems with formatting. One of the most common problems is formatting time.<\/p>\n\n\n\n

In the example below, we will show how to convert our cell or range to time, when we have the same time stored in a string variable. Then we will use another example for the same exercise, but to format the date, not just the time.<\/p>\n\n\n\n

Convert Time String to Time<\/h2>\n\n\n\n

It is very important to understand that for Excel, time is observed simply as a number. For example, number 1 represents the oldest date in Excel, which is 1\/1\/1900<\/strong>. If we have our number stored in a string, the first thing that we need to do is convert it to a number.<\/p>\n\n\n\n

Let us say that we have the following time values in our workbook:<\/p>\n\n\n\n

\"A<\/figure>\n\n\n\n

From these numbers above, we would like to have a proper time, for example, we would like the first cell to be equal to 18:10<\/strong>, or 6:10 PM<\/strong>.<\/p>\n\n\n\n

Our first job is to convert string numbers into time value numbers. To do so, we will use the formula:<\/p>\n\n\n\n

=TIMEVALUE(LEFT(A2,LEN(A2)-2)&\":\"&RIGHT(A2,2))<\/code><\/pre>\n\n\n\n

The TIMEVALUE<\/strong> function serves for converting time presented as text into Excel time. The rest of the function makes sure we return one or two characters of the string, depending on the total number of characters, adds a \u201c:\u201d <\/strong>sign, and returns two characters that are located on the right side of the string.<\/p>\n\n\n\n

As a result, we get the following numbers:<\/p>\n\n\n\n

\"Table\n\nDescription<\/figure>\n\n\n\n

These numbers in column B<\/strong> are nothing but the numeric representation of the time that is stored but \u201ehidden\u201c in column A<\/strong>. We will copy and paste values from column B<\/strong> to column C<\/strong>, select the values in column C<\/strong> that we want to format, go to the Home tab<\/strong> and click on the button in the bottom right corner next to Number:<\/strong><\/p>\n\n\n\n

\"Graphical On the pop-up window that appears, we will choose Time<\/strong>, and select an option that we prefer:<\/p>\n\n\n\n

\"Graphical<\/figure>\n\n\n\n

In our case, we will choose option number 3<\/strong>, which is an option to show AM or PM<\/strong> for the hours. You can already see that our numbers are converted to time values.<\/p>\n\n\n\n

When we click OK<\/strong>, our table looks like this:<\/p>\n\n\n\n

\"Graphical<\/figure>\n\n\n\n

Convert Date and Time String to Date and Time<\/h2>\n\n\n\n

When we have date and time written as a string, we can also use a formula to help us convert our string to something senseless, i.e. to a proper date and time formatting.<\/p>\n\n\n\n

Let us say we have the following numbers in a string:<\/p>\n\n\n\n

\"Graphical<\/figure>\n\n\n\n

We can see that number in cell A2<\/strong> represents the 6th of June of 2021<\/strong>, and the time is set to 20:20<\/strong>.<\/p>\n\n\n\n

But we need to convert this into this said date and time. To achieve this, we will use the formula below:<\/p>\n\n\n\n

=DATE(LEFT(A2,4),MID(A2,5,2),MID(A2,7,2))+TIME(MID(A2,10,2),RIGHT(A2,2),0)<\/code><\/pre>\n\n\n\n

This formula first finds a date, using the LEFT formula<\/strong> and four digits from the left side for a year, MID formula<\/strong> for finding month and day, while starting from the fifth and seventh value in the string, and taking two values for month and two for the day.<\/p>\n\n\n\n

Then, the formula finds time, and takes hours from the MID formula<\/strong>, starting from the 10th value in our string, and taking two numbers. Then it uses the RIGHT formula<\/strong> to find minutes and takes two values.<\/p>\n\n\n\n

Formulas LEFT, MID and RIGHT<\/strong> are usually used to derive a certain value from a string, and the formula above shows it in a very good way.<\/p>\n\n\n\n

Once we insert our formula in cell B2<\/strong> and drag it to the end of our table, we get the following results:<\/p>\n\n\n\n

\"Table\n\nDescription<\/figure>\n\n\n\n

We will copy these numbers into column C<\/strong>, select the values, and then go to formatting options again and choose a date with time option:<\/p>\n\n\n\n

\"Graphical<\/figure>\n\n\n\n

Once we click OK<\/strong>, we will see desired results:<\/p>\n\n\n\n

\"Table\n\nDescription<\/figure>\n","protected":false},"excerpt":{"rendered":"

A lot of times, people are giving up on Excel because they have problems with formatting. One of the most common problems is…<\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[23],"tags":[170],"yoast_head":"\nHow to Convert Time String to Time in Excel<\/title>\n<meta name=\"description\" content=\"Learn how to convert a time string to a time value in Excel using our easy-to-follow guide. Download the file for step-by-step instructions.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/officetuts.net\/excel\/formulas\/convert-time-string-to-time\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Convert Time String to Time in Excel\" \/>\n<meta property=\"og:description\" content=\"Learn how to convert a time string to a time value in Excel using our easy-to-follow guide. Download the file for step-by-step instructions.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/officetuts.net\/excel\/formulas\/convert-time-string-to-time\/\" \/>\n<meta property=\"article:published_time\" content=\"2022-01-13T16:19:25+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-02-19T14:52:27+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/officetuts.net\/excel\/wp-content\/uploads\/sites\/2\/2022\/01\/a-picture-containing-text-furniture-screenshot.png\" \/>\n<meta name=\"author\" content=\"Harun Spahic\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Harun Spahic\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/officetuts.net\/excel\/formulas\/convert-time-string-to-time\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/officetuts.net\/excel\/formulas\/convert-time-string-to-time\/\"},\"author\":{\"name\":\"Harun Spahic\",\"@id\":\"https:\/\/officetuts.net\/excel\/#\/schema\/person\/694491c70f776081acdac4ae41f222a2\"},\"headline\":\"How to Convert Time String to Time in Excel\",\"datePublished\":\"2022-01-13T16:19:25+00:00\",\"dateModified\":\"2024-02-19T14:52:27+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/officetuts.net\/excel\/formulas\/convert-time-string-to-time\/\"},\"wordCount\":643,\"publisher\":{\"@id\":\"https:\/\/officetuts.net\/excel\/#\/schema\/person\/41b0b6996aaa4c4127f86f3d24452d42\"},\"image\":{\"@id\":\"https:\/\/officetuts.net\/excel\/formulas\/convert-time-string-to-time\/#primaryimage\"},\"thumbnailUrl\":\"http:\/\/officetuts.net\/excel\/wp-content\/uploads\/sites\/2\/2022\/01\/a-picture-containing-text-furniture-screenshot.png\",\"keywords\":[\"file\"],\"articleSection\":[\"formulas\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/officetuts.net\/excel\/formulas\/convert-time-string-to-time\/\",\"url\":\"https:\/\/officetuts.net\/excel\/formulas\/convert-time-string-to-time\/\",\"name\":\"How to Convert Time String to Time in Excel\",\"isPartOf\":{\"@id\":\"https:\/\/officetuts.net\/excel\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/officetuts.net\/excel\/formulas\/convert-time-string-to-time\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/officetuts.net\/excel\/formulas\/convert-time-string-to-time\/#primaryimage\"},\"thumbnailUrl\":\"http:\/\/officetuts.net\/excel\/wp-content\/uploads\/sites\/2\/2022\/01\/a-picture-containing-text-furniture-screenshot.png\",\"datePublished\":\"2022-01-13T16:19:25+00:00\",\"dateModified\":\"2024-02-19T14:52:27+00:00\",\"description\":\"Learn how to convert a time string to a time value in Excel using our easy-to-follow guide. Download the file for step-by-step instructions.\",\"breadcrumb\":{\"@id\":\"https:\/\/officetuts.net\/excel\/formulas\/convert-time-string-to-time\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/officetuts.net\/excel\/formulas\/convert-time-string-to-time\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/officetuts.net\/excel\/formulas\/convert-time-string-to-time\/#primaryimage\",\"url\":\"http:\/\/officetuts.net\/excel\/wp-content\/uploads\/sites\/2\/2022\/01\/a-picture-containing-text-furniture-screenshot.png\",\"contentUrl\":\"http:\/\/officetuts.net\/excel\/wp-content\/uploads\/sites\/2\/2022\/01\/a-picture-containing-text-furniture-screenshot.png\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/officetuts.net\/excel\/formulas\/convert-time-string-to-time\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/officetuts.net\/excel\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Convert Time String to Time in Excel\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/officetuts.net\/excel\/#website\",\"url\":\"https:\/\/officetuts.net\/excel\/\",\"name\":\"\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/officetuts.net\/excel\/#\/schema\/person\/41b0b6996aaa4c4127f86f3d24452d42\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/officetuts.net\/excel\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/officetuts.net\/excel\/#\/schema\/person\/41b0b6996aaa4c4127f86f3d24452d42\",\"name\":\"Tomasz Decker\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/officetuts.net\/excel\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/18cbe22837193574870ae40ba56bf712?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/18cbe22837193574870ae40ba56bf712?s=96&d=mm&r=g\",\"caption\":\"Tomasz Decker\"},\"logo\":{\"@id\":\"https:\/\/officetuts.net\/excel\/#\/schema\/person\/image\/\"},\"description\":\"Spreadsheet and Python enthusiast.\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/officetuts.net\/excel\/#\/schema\/person\/694491c70f776081acdac4ae41f222a2\",\"name\":\"Harun Spahic\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/officetuts.net\/excel\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/b7b887a2249679182be5550a4421a7a9?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/b7b887a2249679182be5550a4421a7a9?s=96&d=mm&r=g\",\"caption\":\"Harun Spahic\"},\"sameAs\":[\"http:\/\/human.bsru.ac.th\/\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Convert Time String to Time in Excel","description":"Learn how to convert a time string to a time value in Excel using our easy-to-follow guide. Download the file for step-by-step instructions.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/officetuts.net\/excel\/formulas\/convert-time-string-to-time\/","og_locale":"en_US","og_type":"article","og_title":"How to Convert Time String to Time in Excel","og_description":"Learn how to convert a time string to a time value in Excel using our easy-to-follow guide. Download the file for step-by-step instructions.","og_url":"https:\/\/officetuts.net\/excel\/formulas\/convert-time-string-to-time\/","article_published_time":"2022-01-13T16:19:25+00:00","article_modified_time":"2024-02-19T14:52:27+00:00","og_image":[{"url":"http:\/\/officetuts.net\/excel\/wp-content\/uploads\/sites\/2\/2022\/01\/a-picture-containing-text-furniture-screenshot.png"}],"author":"Harun Spahic","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Harun Spahic","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/officetuts.net\/excel\/formulas\/convert-time-string-to-time\/#article","isPartOf":{"@id":"https:\/\/officetuts.net\/excel\/formulas\/convert-time-string-to-time\/"},"author":{"name":"Harun Spahic","@id":"https:\/\/officetuts.net\/excel\/#\/schema\/person\/694491c70f776081acdac4ae41f222a2"},"headline":"How to Convert Time String to Time in Excel","datePublished":"2022-01-13T16:19:25+00:00","dateModified":"2024-02-19T14:52:27+00:00","mainEntityOfPage":{"@id":"https:\/\/officetuts.net\/excel\/formulas\/convert-time-string-to-time\/"},"wordCount":643,"publisher":{"@id":"https:\/\/officetuts.net\/excel\/#\/schema\/person\/41b0b6996aaa4c4127f86f3d24452d42"},"image":{"@id":"https:\/\/officetuts.net\/excel\/formulas\/convert-time-string-to-time\/#primaryimage"},"thumbnailUrl":"http:\/\/officetuts.net\/excel\/wp-content\/uploads\/sites\/2\/2022\/01\/a-picture-containing-text-furniture-screenshot.png","keywords":["file"],"articleSection":["formulas"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/officetuts.net\/excel\/formulas\/convert-time-string-to-time\/","url":"https:\/\/officetuts.net\/excel\/formulas\/convert-time-string-to-time\/","name":"How to Convert Time String to Time in Excel","isPartOf":{"@id":"https:\/\/officetuts.net\/excel\/#website"},"primaryImageOfPage":{"@id":"https:\/\/officetuts.net\/excel\/formulas\/convert-time-string-to-time\/#primaryimage"},"image":{"@id":"https:\/\/officetuts.net\/excel\/formulas\/convert-time-string-to-time\/#primaryimage"},"thumbnailUrl":"http:\/\/officetuts.net\/excel\/wp-content\/uploads\/sites\/2\/2022\/01\/a-picture-containing-text-furniture-screenshot.png","datePublished":"2022-01-13T16:19:25+00:00","dateModified":"2024-02-19T14:52:27+00:00","description":"Learn how to convert a time string to a time value in Excel using our easy-to-follow guide. Download the file for step-by-step instructions.","breadcrumb":{"@id":"https:\/\/officetuts.net\/excel\/formulas\/convert-time-string-to-time\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/officetuts.net\/excel\/formulas\/convert-time-string-to-time\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/officetuts.net\/excel\/formulas\/convert-time-string-to-time\/#primaryimage","url":"http:\/\/officetuts.net\/excel\/wp-content\/uploads\/sites\/2\/2022\/01\/a-picture-containing-text-furniture-screenshot.png","contentUrl":"http:\/\/officetuts.net\/excel\/wp-content\/uploads\/sites\/2\/2022\/01\/a-picture-containing-text-furniture-screenshot.png"},{"@type":"BreadcrumbList","@id":"https:\/\/officetuts.net\/excel\/formulas\/convert-time-string-to-time\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/officetuts.net\/excel\/"},{"@type":"ListItem","position":2,"name":"How to Convert Time String to Time in Excel"}]},{"@type":"WebSite","@id":"https:\/\/officetuts.net\/excel\/#website","url":"https:\/\/officetuts.net\/excel\/","name":"","description":"","publisher":{"@id":"https:\/\/officetuts.net\/excel\/#\/schema\/person\/41b0b6996aaa4c4127f86f3d24452d42"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/officetuts.net\/excel\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/officetuts.net\/excel\/#\/schema\/person\/41b0b6996aaa4c4127f86f3d24452d42","name":"Tomasz Decker","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/officetuts.net\/excel\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/18cbe22837193574870ae40ba56bf712?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/18cbe22837193574870ae40ba56bf712?s=96&d=mm&r=g","caption":"Tomasz Decker"},"logo":{"@id":"https:\/\/officetuts.net\/excel\/#\/schema\/person\/image\/"},"description":"Spreadsheet and Python enthusiast."},{"@type":"Person","@id":"https:\/\/officetuts.net\/excel\/#\/schema\/person\/694491c70f776081acdac4ae41f222a2","name":"Harun Spahic","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/officetuts.net\/excel\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/b7b887a2249679182be5550a4421a7a9?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/b7b887a2249679182be5550a4421a7a9?s=96&d=mm&r=g","caption":"Harun Spahic"},"sameAs":["http:\/\/human.bsru.ac.th\/"]}]}},"_links":{"self":[{"href":"https:\/\/officetuts.net\/excel\/wp-json\/wp\/v2\/posts\/8742"}],"collection":[{"href":"https:\/\/officetuts.net\/excel\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/officetuts.net\/excel\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/officetuts.net\/excel\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/officetuts.net\/excel\/wp-json\/wp\/v2\/comments?post=8742"}],"version-history":[{"count":3,"href":"https:\/\/officetuts.net\/excel\/wp-json\/wp\/v2\/posts\/8742\/revisions"}],"predecessor-version":[{"id":13706,"href":"https:\/\/officetuts.net\/excel\/wp-json\/wp\/v2\/posts\/8742\/revisions\/13706"}],"wp:attachment":[{"href":"https:\/\/officetuts.net\/excel\/wp-json\/wp\/v2\/media?parent=8742"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/officetuts.net\/excel\/wp-json\/wp\/v2\/categories?post=8742"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/officetuts.net\/excel\/wp-json\/wp\/v2\/tags?post=8742"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}