Solved

Converting Time Range to Date/Time in a single field

Posted on 2016-09-02
7
48 Views
Last Modified: 2016-09-06
I have a spreadsheet with two rows, one with a date, and one with a time range.

CourseDate      Course Time
9/7/2016      9:00 am - 9:50 am

But I  need to convert it to this start date/time and end date/time like below.

Start Date/Time      End Date/Time
9/7/16 9:00 AM      9/7/16 9:50 AM

Is there any way to do this automatically? I tried text to columns for the time, and then did a concatenate to put the date and time together. However, when you do that it changes the time to something like 0.375. Changing the format of the cells didn’t help either.

Thank you in advance for any suggestions!
0
Comment
Question by:jalant
7 Comments
 
LVL 29

Accepted Solution

by:
Subodh Tiwari (Neeraj) earned 250 total points
ID: 41782269
Assuming
A2 = 9/7/2016
B2 = 9:00 am - 9:50 am

Start Time Formula:
=A2+LEFT(B2,FIND("-",B2)-1)

Open in new window


End Time Formula:
=A2+REPLACE(B2,1,FIND("-",B2)+1,"")

Open in new window

Custom format the formula cells with m/d/yyyy hh:mm am/pm
0
 
LVL 14

Assisted Solution

by:Edward Pamias
Edward Pamias earned 250 total points
ID: 41782270
Try this....
EE-Sample-file.xlsx
0
 
LVL 14

Expert Comment

by:Edward Pamias
ID: 41782272
Sorry Neeraj :(
0
Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

 
LVL 29

Expert Comment

by:Subodh Tiwari (Neeraj)
ID: 41782283
Why sorry Edward? Nothing wrong in it. :)
0
 

Author Closing Comment

by:jalant
ID: 41782296
Thank you both for your help!
0
 
LVL 29

Expert Comment

by:Subodh Tiwari (Neeraj)
ID: 41782298
You're welcome. Glad to help.
0
 
LVL 32

Expert Comment

by:Rob Henson
ID: 41786328
However, when you do that it changes the time to something like 0.375.

For your information Excel handles Date and Time as serial numbers.

Date is an integer number of days since an historical date of 01 Jan 1900. Today (6 Sept 2016) as a serial number would be 42619 ie 42619 days since 1 Jan 1900.

Time is then a decimal portion of a day, one hour being 1/24 of a day, further divided by 60 for minutes and further divided by 60 for seconds; 1440 minutes or 86400 seconds in a day. The 0.375 would represent 9:00 as expected; if you perform the sum =9/24 it would give 0.375.

Hope that clarifies.
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Excel VBA 10 38
Auto Populate Day Month  2 digit Date 4 15
Copy a range from 1..n excel sheets to one destination sheet 2 29
Excel VBA 4 26
INDEX and MATCH can be used to great effect to replace HLOOKUP and VLOOKUP as it does not have the limitation of needing the data to be sorted so that the reference value is in the first column or row. It also has the ability to perform a bi-directi…
Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now