» Converting Text, Which Represents Date and Time, Into Proper Date and Time Values
CATEGORY - Excel Date & Time Formulas
VERSION - All Microsoft Excel Versions
Problem:Column A contains strings which represent dates and times that have been formatted as "mmm d yyyy h:mm:ss PM/AM".
We want to extract the date and time from each string, place them in separate cells, and convert them into properly formatted date and time values.
Solution:
To extract dates, use the MID, LEFT, FIND, and SUBSTITUTE functions as shown in the following formula:
=(--(MID(A2,5,2)&" "&LEFT(A2,3)&" "&MID(A2,FIND(" ",SUBSTITUTE(
A2," ","",1))+2,4)))
Enter the above formula in column B and format as "mm/dd/yyyy".
To extract times, use the MID, FIND, and SUBSTITUTE functions as shown in the following formula:
=(--(MID(A2,FIND(" ",SUBSTITUTE(A2," ","",1))+7,255)))
Enter the above formula in column C and format as "h:mm PM/AM".
Book Store:
Recommended Books:
- Successful Business Planning in 30 Days: A Step-By-Step Guide for Writing a Business Plan and Starting Your Own Business
- How to Read A Financial Report
- A Mathematician Plays the Stock Market
- AWAKEN THE GIANT WITHIN : HOW TO TAKE IMMEDIATE CONTROL OF YOUR MENTAL, EMOTIONAL, PHYSICAL AND FINANCIAL
- Microsoft Excel 2002 Simply Visual
- The Essential 55: An Award-Winning Educator's Rules for Discovering the Successful Student in Every Child
No comments have been submitted.

