Text Format To Date Format

gmazza76

Well-known Member
Joined
Mar 19, 2011
Messages
774
Office Version
  1. 365
Platform
  1. Windows
Good morning,

I am using PowerPivot to look at a large data file I have been sent but I am having an issue with the dates in a column.

I have a column that holds an amount of data in Column A in including the time but it shows as
"TIME=20201026021813357". I have used "=mid()" to pull the date out of this as "20201026", but I need to change this into an actual date format.

I would look at power Query, but I haven't used this before so is there an easy way to fix this in PowerPivot as I will be linking this file on a weekly basis and would like the calculations to work automatically when the information is uploaded weekly.

I am currently using the below and it gives "2610", but I am having an issue adding the 3rd part in to add the year.
Code:
=CONCATENATE(mid(Table[F1],12,2),MID(Table[F1],10,2))

thanks in advance
Gavin
 
Last edited:

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
I have used the following to amend the date as follows

Code:
=date(mid(Table[F1],12,2),Mid(Table[F1],10,2),mid(Table[F1],6,4))
using the Table[F1] has the value "TIME=20201026021813357", but the date is coming out as "11/07/1932"

Any suggestions?
 
Upvote 0
maybe
Column1First Characters
2020102602181335726/10/2020

Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table9"]}[Content],
    First10 = Table.AddColumn(Source, "First Characters", each Text.Start([Column1], 8), type text),
    Type = Table.TransformColumnTypes(First10,{{"First Characters", type date}})
in
    Type
 
Upvote 0
thanks for this @sandy666, but I haven't used Power Query in PowerPivot at all.
I am unsure if the works systems have this so is there anyway I can do this without using PowerQuery
 
Upvote 0
Use Power Query , do any transformation what you want, eg. text string to date then load it to the Data Model for Power Pivot
 
Upvote 0
thank you @sandy666, I have managed to get the original formula working as I had tried to split the date incorrectly. ie year should have been the first part where as I did it last.

I will be trying the other Power Query Option as it seems more straight forward
 
Upvote 0
year should have been the first part where as I did it last
it depends on the system date, ie. yours can be yyyy/mm/dd (probably) , but mine is dd/mm/yyy
anyway function is : (PQ) #date(yyyy, mm, dd) or (DAX) DATE(<year>, <month>, <day>)
glad you solved that problem
have a nice day
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,827
Messages
6,181,199
Members
453,022
Latest member
RobertV1609

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top