How to Convert Text to Dates [Data Cleanup]

Share

Facebook
Twitter
LinkedIn

How to Convert Text to Dates

Sometimes when we import data from another source in to excel, the dates are not imported properly. This can be due to any number of reasons, including,

  • The date format is different from one that is understood by excel
  • The data has some extra spaces, other characters before and after the date values.
  • The dates are formatted for another country (or date system) and hence your version of Excel wont recognize them.
  • The separator between date, month and year is not a known separator (for eg. 12=DEC=2009 instead of 12-Dec-2009), etc.

In this post, we will learn some tricks and ideas you can use to quickly convert text to dates.

Technique 1: Use Text to Columns Utility

  1. First copy the source data and paste it in a text file (open Notepad and paste there).
  2. Now copy the values from text file and paste them in Excel.
  3. At this point, Excel will prompt you for using “Text to columns” utility (or Text Import Wizard as it is called in Excel 2007)
    Text to columns utility (Text Import Wizard) Prompt
  4. Go to the Text Import Wizard (or Text to Columns dialog).
  5. Leave defaults or make changes in step 1 & 2.
  6. In step 3, select “Date” and specify the format of the date – like YMD, MDY, DMY, YDM, MYD or DYM. It doesn’t matter what is the format of source date, month or year is. Excel can smartly understand them.
    Text to date using Text Import Wizard in Excel
  7. Click “Finish”.

That is all. Your text dates are now converted to excel understandable dates.

Technique 2: Using Formulas to Convert Text to Dates

  1. Paste the data in a column (say “A”)
  2. Now depending on the format of source data, write one of the below formulas to convert text to dates.

Using DATEVALUE formula

DATEVALUE formula tells excel to fetch the date from a given input. It is a smart formula capable of converting dates stored as text to excel understandable date format. To convert a text in cell A1 to date, you just write =DATEVALUE(A1)

However, DATEVALUE formula has some limitations. It cannot process all types of dates. For eg. I have shown a few sample dates along with corresponding DATEVALUE output.

Using DATEVALUE formula to convert Text to Date

Readjusting Date Text so that it works with DATEVALUE formula

Whenever possible, your next best option is to re-adjust the source data text so that it can be understood by DATEVALUE formula. Here is an example.

Using Text formulas and DATEVALUE to convert Text to Date

We can use the text formulas like LEFT, RIGHT and MID to extract portions of the date text and then regroup them using & operator to create meaningful date text format that would be understood by DATEVALUE formula.

Technique 3: Using DATE formula to Convert Text to Dates

If your data has separate columns for date, month and year, you can use DATE formula to convert the data to dates like this:

=DATE(year,month,day)

For eg. =DATE(2009,12,31) will give the date 31st December, 2009.

Bonus Technique: Converting Dates to Text

If you want to convert excel dates to text values (for your report or some other purpose), you can use the TEXT formula like this:

=TEXT(A1,"DD-MMM-YYYY") will convert date in Cell A1 to DD-MMM-YYYY format. You can pass any other date / time formats to TEXT formula as well. [more: tutorials on TEXT() formula]

How do you deal with troublesome dates?

Of course, if it is a real date, we can always bolt. But if it is a date in the data, we need some tools to deal with it. I used to rely on formula based methods to clean the dates. But recently I discovered the import-text date conversion method. This is very powerful and straightforward. Now, I use it whenever possible to clean up my date data.

What about you? How do you deal with buggy / faulty dates in Excel?

Recommended Articles:

Facebook
Twitter
LinkedIn

Share this tip with your colleagues

Excel and Power BI tips - Chandoo.org Newsletter

Get FREE Excel + Power BI Tips

Simple, fun and useful emails, once per week.

Learn & be awesome.

Welcome to Chandoo.org

Thank you so much for visiting. My aim is to make you awesome in Excel & Power BI. I do this by sharing videos, tips, examples and downloads on this website. There are more than 1,000 pages with all things Excel, Power BI, Dashboards & VBA here. Go ahead and spend few minutes to be AWESOME.

Read my storyFREE Excel tips book

Overall I learned a lot and I thought you did a great job of explaining how to do things. This will definitely elevate my reporting in the future.
Rebekah S
Reporting Analyst
Excel formula list - 100+ examples and howto guide for you

From simple to complex, there is a formula for every occasion. Check out the list now.

Calendars, invoices, trackers and much more. All free, fun and fantastic.

Advanced Pivot Table tricks

Power Query, Data model, DAX, Filters, Slicers, Conditional formats and beautiful charts. It's all here.

Still on fence about Power BI? In this getting started guide, learn what is Power BI, how to get it and how to create your first report from scratch.

21 Responses to “Make a Pivot Table in Excel [15 Second Tutorial]”

  1. [...] First step is to create Pivot Table. Here is a video tutorial on making pivot tables. [...]

  2. Wilson says:

    Dear Sir,

    I would like to study pivot table from basics detailed.Pls send me the tips of that

  3. baran says:

    merccccccccccccccccccccccccccccccccccccc

  4. [...] Click here to see a video tutorial of making pivot tables in excel | One more Pivot Table Video Tutorial [...]

  5. surbamanyam says:

    it is very useful

  6. jitender says:

    hello sir

    please send me some information of pivotable. and how to use it
    because I am beginer so how can i learn it the pivotable.
    and sir will you send me pivotable data because i have no data and i don't
    know how to applyed for the pivotable. give some videos so I learn quikely.

    thank you
    and my best
    anticipation

  7. keri says:

    Hi,

    This tutorail was helpful. If possible can you please email me some data, so I can create another pivot table? I am trying to learn ASAP and need some info.

    Thank you

  8. yemi says:

    Top of the day to you. can you pls send me a detailed tutorial on the pivot table tutorial? Thanks.

  9. karthick says:

    Hi,
    please tell me how to use Pivot table.

  10. Pooja says:

    Dear Sir,
    I visited this website of urs for the very first time and trust me this is fabulous.i learnt pivot table through this.Thanks a lot.In corporate world nobody gonna make u learn these things.m very grateful to u.This is a great initiative from ur side.Commendable job done.Hats off to u.For beginners also this is very helpful.The way this website makes u learn excel is very good.

    Pooja

  11. Priscilla says:

    Can you please email me information to put into a pivot table and possibly a complete set of instructions?  I am a beginner to pivot tables and am possibly interested in obtaining a position that requires pivot tables.  thank you.

  12. [...] Click here to see a video tutorial of making pivot tables in excel | One more Pivot Table Video Tutorial [...]

  13. Kawsar says:

    It's simply great..!!

  14. James Perry says:

    Cool!
    Fast but not furious.

  15. Adepoju Teniola says:

    Pls email me details of pivot table. I want to learn it asap because I just got a job that requires this. Thanks

  16. nihal ahmed says:

    it is very useful..............thanks

  17. Tabassum says:

    Sir please can u send me the complete explanation of pivot tables from basics

  18. Guruprasad says:

    hello,

    I wanted to know how to put pivot with emp id, emp name, emp position in one row.

    Ex:-
    cel A4 should have Emp id
    Cell B4 should have Emp Name
    Call C4 should have Emp Position

    many thanks in advance

  19. George Dorne says:

    Nice information, thanx my dear.

Leave a Reply