First thing you have to do is make sure that your data, no matter what format it comes in as, Excel recognizes it as a date and or time data type.
.
Where is the data coming from?
.
How are you getting it into Excel?
.
Macros are the "traditional" approach. You can also use formulas to do the same thing. The "new" method is to use PowerQuery.
.
PowerQuery is a tool to import and "clean" data. The import can be from an Excel spreadsheet, or from 80+ sources outside of Excel. To use it, you tell PowerQuery where to get the data, then you can setup up any number of steps to modify your data into a desired final format. Data type conversion, specifically dates is one of the common manipulations.
.
Like macros, PowerQueries can be reused on new data any number of times.
Here are a couple of articles to show you the possibilities. If you want (more) help getting started in PowerQuery I have more basic articles you can work with.
@ Easily Fix Dates Formatted as Text with Power Query – Find/Replace text in PQ - Searching for Text Strings in Power Query 2020 10 21
https://www.myonlinetraininghub.com/searching-for-text-strings-in-power-query
https://www.youtube.com/watch?v=0RN3FZv3w84&rel=0 12min47
This week’s video from Mynda shows us how to easily fix dates formatted as text and addresses a common problem when opening CSV or text files in Excel containing dates that don’t match your region’s date format.
Power Query makes fixing dates entered as text in Excel super easy, and it's quick to update when you get new data.
. * The query to create a list of words (extract words from a table)
. * The list created by the query
. * Finding Substrings
. * Finds Substrings - Ignoring Case
. * Exact Match String Searches
. * Exact Match String Searches - Ignoring Case
. * PQ M Functions: List.ContainsAny(), List.Transform(), Table.AddColumn(), Table.ToList(), Text.Contains(),Text.Split()
.
4 Ways to Fix Date Errors in Power Query + Locale & Regional Settings 2020 04 29 Jon Acampora
https://www.excelcampus.com/powerquery/power-query-date-errors-settings/
Learn 4 different ways to fix date data type errors in Power Query, including with locale, regional settings, and custom formulas with Column From Examples. Sometimes in Power Query, when you attempt to format data as a date, you will receive error messages. This is because Power Query is unable to recognize the data. The most common occurrence for this is when the original format of the date is from a different region.
. 1. Locale in Data Type Menu
. 2. Locale in Regional Settings
. 3. Operating System Regional Settings
. 4. Custom Formula with Column From Examples
.