Solved

time field - combining columns

Posted on 2014-10-08
3
108 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Find Minimum and Maximum Dates in a column using Power Query 15 48
First Blank Cell in a range 7 34
Delete texts with font color 16 30
InternetExplorer object in Excel VBA. 4 21
Introduction This Article is a follow-up to my Mappit! Addin Article (http://www.experts-exchange.com/A_2613.html), it was inspired by an email posting I made to EUSPRIG (http://www.eusprig.org/index.htm), I will briefly cover: 1) An overvie…
This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
The viewer will learn how to simulate a series of sales calls dependent on a single skill level and learn how to simulate a series of sales calls dependent on two skill levels. Simulating Independent Sales Calls: Enter .75 into cell C2 – “skill leve…
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.

911 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

20 Experts available now in Live!

Get 1:1 Help Now