Solved

time field - combining columns

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Introduction While answering a recent question (http:/Q_27311462.html), I created an alternative function to the Excel Concatenate() function that you might find useful.  I tested several solutions and share the results in this article as well as t…
Approximate matching with VLOOKUP and MATCH seems to me to be a greatly under-used technique, and one which is vital for getting good performance out of large lookups. Until recently I would always have advised using an exact match for simplicity an…
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 Microsoft Excel how to add style and sexy appeal to horizontal bar charts.

757 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

18 Experts available now in Live!

Get 1:1 Help Now