+ Reply to Thread
Results 1 to 29 of 29

convert text to date in power query

  1. #1
    Forum Contributor
    Join Date
    12-12-2022
    Location
    italy
    MS-Off Ver
    office 365
    Posts
    164

    convert text to date in power query

    Hi guys I need a hand, in the file that I attach I have a date column which is in text format. When I import the file into a query connection table it displays the correct data but if I change the column to date format power qyery gives me an error how can i fix it? i tried to create a custom column,but sometimes it works sometimes not.

    thank you allOFReport2 (ETD)_FCO_20230608_20230608.xls

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,978

    Re: convert text to date in power query

    The file is in .xls format, so the query has been stripped out. Save in .xlsx format.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Forum Contributor
    Join Date
    12-12-2022
    Location
    italy
    MS-Off Ver
    office 365
    Posts
    164

    Re: convert text to date in power query

    Hi thanks for the help, I have not attached the file with the query, but only the file that is imported to show you what format the date was in
    example 80623 but I would like it 08/06/2023

  4. #4
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: convert text to date in power query

    select column B and set to short date format then save to xlsx and use in Power Query

  5. #5
    Forum Contributor
    Join Date
    12-12-2022
    Location
    italy
    MS-Off Ver
    office 365
    Posts
    164

    Re: convert text to date in power query

    Hi I tried to do as you say but it gives me this value 09/25/2120

  6. #6
    Forum Contributor
    Join Date
    12-12-2022
    Location
    italy
    MS-Off Ver
    office 365
    Posts
    164

    Re: convert text to date in power query

    Anyway the file I have attached is located in a folder together with the master file. When I open the Master file it automatically loads the data

  7. #7
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: convert text to date in power query

    what format is of your system date?

  8. #8
    Forum Contributor
    Join Date
    12-12-2022
    Location
    italy
    MS-Off Ver
    office 365
    Posts
    164

    Re: convert text to date in power query

    Hi, sorry if you are talking about the master file it is in xlsb office 365

  9. #9
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: convert text to date in power query

    I am asking about your system date

  10. #10
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,829

    Re: convert text to date in power query

    I can't help with the power query stuff, but, if it helps, I note that the serial number 80623 (the number entered in column B) is the serial number for 25 September 2120. It looks like your current attempts with Power Query are simply copying the number in column B as if it is the serial number for the desired date. You have somehow not instructed PQ how it should parse the number/text to get month, year, and day from the value entered.
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  11. #11
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: convert text to date in power query

    this date format is correct for you?

    Date
    25/09/2120
    25/09/2120
    25/09/2120
    25/09/2120
    25/09/2120
    25/09/2120
    25/09/2120
    25/09/2120
    25/09/2120
    25/09/2120
    25/09/2120
    25/09/2120
    25/09/2120
    25/09/2120
    25/09/2120

  12. #12
    Forum Contributor
    Join Date
    12-12-2022
    Location
    italy
    MS-Off Ver
    office 365
    Posts
    164

    Re: convert text to date in power query

    Hi yes exactly it just should be 80623= 08/06/2023 day,mounth,year
    Last edited by francescoslash77; 06-09-2023 at 04:54 PM.

  13. #13
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Cool Re: convert text to date in power query

    so here is,
    load to the sheet or stay with query only, it's up to you

    btw. there is no text in B column so enough to change serial number to date

  14. #14
    Forum Contributor
    Join Date
    12-12-2022
    Location
    italy
    MS-Off Ver
    office 365
    Posts
    164

    Re: convert text to date in power query

    Thank you for your help, but I can't change the date in the attached file, because it's a file that changes every day. I download it from a company program and insert it in the folder where I have the master file. then the date is not 09/25/2120
    but it must come out 08/06/2023 the date yesterday's date

  15. #15
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: convert text to date in power query

    so your description in the first post is not enough clear
    use From Folder option and change column [Date] to date format
    what is difference between yesterday's date and week ago date? date is date nothing more!
    and describe detailed here what are you really doing - step by step
    edit: and I asked you about your system date! could you answer ?

    and update your profile about excel Product Number and Version
    Last edited by sandy666; 06-09-2023 at 05:16 PM.

  16. #16
    Forum Contributor
    Join Date
    12-12-2022
    Location
    italy
    MS-Off Ver
    office 365
    Posts
    164

    Re: convert text to date in power query

    if I do it from power query it gives me an errorerror.PNGerror1.PNG

  17. #17
    Forum Contributor
    Join Date
    12-12-2022
    Location
    italy
    MS-Off Ver
    office 365
    Posts
    164

    Re: convert text to date in power query

    Maybe as Mr Shorty said I need to change something in power query setup

  18. #18
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: convert text to date in power query

    add column with Number.From([Date]) then change type to Date

    and could you answer on my question?

  19. #19
    Forum Contributor
    Join Date
    12-12-2022
    Location
    italy
    MS-Off Ver
    office 365
    Posts
    164

    Re: convert text to date in power query

    Sorry but I don't understand what you mean by system date

  20. #20
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: convert text to date in power query

    do you have SYSTEM MacOS, Windows, Unix, Linux? choose one and tell me about system date

  21. #21
    Forum Contributor
    Join Date
    12-12-2022
    Location
    italy
    MS-Off Ver
    office 365
    Posts
    164

    Re: convert text to date in power query

    I am using Windows 10 EnterpriseAttachment 832473

  22. #22
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: convert text to date in power query

    look at this

    datetime.png

  23. #23
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: convert text to date in power query

    your attachment is added incorrectly

  24. #24
    Forum Contributor
    Join Date
    12-12-2022
    Location
    italy
    MS-Off Ver
    office 365
    Posts
    164

    Re: convert text to date in power query


  25. #25
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: convert text to date in power query

    ok, use function from post#18 to get serial number from text and then change to date

  26. #26
    Forum Contributor
    Join Date
    12-12-2022
    Location
    italy
    MS-Off Ver
    office 365
    Posts
    164

    Re: convert text to date in power query

    I think I solved it, can I delete the old date column?Column.png

  27. #27
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: convert text to date in power query

    yes, you can then move your new column into proper position

  28. #28
    Forum Contributor
    Join Date
    12-12-2022
    Location
    italy
    MS-Off Ver
    office 365
    Posts
    164

    Re: convert text to date in power query

    Thank you, you were very kind

  29. #29
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: convert text to date in power query

    you are welcome



    if the problem is solved, make me happy and hit Add Reputation (bottom left corner next to the post that was helpful)

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Convert CSV to XLSX (power query / transform)
    By jayrocco in forum Excel General
    Replies: 3
    Last Post: 03-17-2023, 06:44 AM
  2. Power Query - Stop trying to Convert to number
    By dw_22801 in forum Excel General
    Replies: 2
    Last Post: 08-11-2022, 12:19 PM
  3. [SOLVED] Power Query - Convert Months to Year
    By samparker095 in forum Excel General
    Replies: 3
    Last Post: 07-08-2022, 04:39 AM
  4. How to convert Text to Date in Power Query
    By Eric Tsang in forum Excel Charting & Pivots
    Replies: 4
    Last Post: 04-11-2020, 01:59 PM
  5. [SOLVED] Convert Formula to Power Query
    By Kcroft9 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 02-11-2020, 10:32 AM
  6. [SOLVED] Power Pivot/Query Convert Existing Table to Query
    By trisoldee in forum Excel Charting & Pivots
    Replies: 3
    Last Post: 08-23-2019, 04:27 PM
  7. Power Query convert Unix time to a date
    By logisteve in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-20-2015, 06:25 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1