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\nLet us say that we have the following time values in our workbook:<\/p>\n\n\n\n <\/figure>\n\n\n\nFrom 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\nOur 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\nThe 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\nAs a result, we get the following numbers:<\/p>\n\n\n\n <\/figure>\n\n\n\nThese 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 On the pop-up window that appears, we will choose Time<\/strong>, and select an option that we prefer:<\/p>\n\n\n\n <\/figure>\n\n\n\nIn 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\nWhen we click OK<\/strong>, our table looks like this:<\/p>\n\n\n\n <\/figure>\n\n\n\nConvert 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 <\/figure>\n\n\n\nWe 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\nBut 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\nThis 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\nThen, 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\nFormulas 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\nOnce 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 <\/figure>\n\n\n\nWe 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 <\/figure>\n\n\n\nOnce we click OK<\/strong>, we will see desired results:<\/p>\n\n\n\n <\/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":"\n
How to Convert Time String to Time in Excel<\/title>\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n\t \n\t \n\t \n