Solved

time field - combining columns

Posted on 2014-10-08
3
124 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
[X]
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
  • 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

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

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

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.
Do you use a spreadsheet like Microsoft's Excel?  Have you ever wanted to link out to a non excel file on your computer or network drive?  This is the way I found to do it!
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 will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.

688 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