Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

time field - combining columns

Posted on 2014-10-08
3
116 Views
Last Modified: 2014-10-08
I essentially have two columns which i pulled out of a huge text line by using right/left/mid functions.  Originally, each row's time would show up as.

0830A (extra verbiage here)    So I used a left (A2,4)  - 0830   then used that column and did left B2,2  = 08  and right B2,2  =30 for the minute.

 I have another column that says if Right(A2,1 = "A", "AM,"PM")

So now I have the hour column, the minute column and the AM/PM columns.  Lets say the hour column was STarting in B2, minute would be C2, and AM/PM would be D2.  

I need to know a formula I can enter to combine those and for those to be true time fields, that I can make calculations between etc.

Thanks,
Andy
0
Comment
Question by:akatz66
  • 2
3 Comments
 
LVL 27

Accepted Solution

by:
Glenn Ray earned 500 total points
ID: 40369566
You can combine all those functions into one formula.  Insert this in cell B2 and copy down:
=TIMEVALUE(LEFT(A2,2)&":"&MID(A2,3,2)&":00 " & MID(A2,5,1)&"M")

Format the cells in column B as "Time" and you'll see the correct times.

Example file attached.

Regards,
-Glenn
EE-Q28534113.xlsx
0
 

Author Closing Comment

by:akatz66
ID: 40369631
Glenn, once again, you never cease to amaze.  I'm sure by how you probably wonder if I know anything in Excel, but everything you teach me I keep in my library of code!  Thanks Again,


Cheers,
Andy
0
 
LVL 27

Expert Comment

by:Glenn Ray
ID: 40369696
Andy, you're more-than welcome.  You were on the right track by splitting out the components; I just went ahead and combined all those steps into one and finished it up.

-Glenn
0

Featured Post

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

Question has a verified solution.

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

Drop Down List with Unique/Distinct Values (Part II - ComboBox or ListBox and Data Validation List Bonus!) David Miller (dlmille) Intro This article focuses on delivering unique, sorted lists to list objects (e.g., ComboBox, ListBox) and Dat…
This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.

828 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