Solved

time field - combining columns

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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

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 40
how to delete specific files and folders with VBA 3 25
Excel conditional formatting based on 'zero value' 6 20
Excel Drop Down List 13 34
Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.

778 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