+ Reply to Thread
Results 1 to 4 of 4

Convert number to Date in Query Editor

  1. #1
    Forum Contributor
    Join Date
    03-12-2012
    Location
    Singapore
    MS-Off Ver
    MS 365
    Posts
    532

    Convert number to Date in Query Editor

    Hi, my raw data look like 20190618 and query editor recongnize it as Number (with the 123 icon). However, when i change type to date using Locale (i wan dd/mm/yyyy). It show error. Anyone can advice how?

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,939

    Re: Convert number to Date in Query Editor

    If that is indeed how your data looks in the formula bar, that is not a date, it is just some random numbers, as far as excel is concerned.

    If you intended to get this as the date...
    6/18/2019

    Then you need to use this formula...
    =DATE(LEFT(U11,4),MID(U11,5,2),RIGHT(U11,2))
    Assuming the cell is U11. Adjust as needed.

    If that was a real date, it would show as 6/18/2019 (or, if formatted as General/Number...43634
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,211

    Re: Convert number to Date in Query Editor

    1. Change type to Text.
    2. Then change to Date by add new step

  4. #4
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,895

    Re: Convert number to Date in Query Editor

    Here is Mcode if you are doing this in Power Query

    Please Login or Register  to view this content.
    You need to convert the "number value" to text and then apply the Date.FromText function in a custom column.
    Last edited by alansidman; 06-18-2019 at 12:45 AM.
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

+ 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. Power Query Editor is Non-Responsive
    By lsloman in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-23-2019, 08:23 PM
  2. Query editor to show Others as MISC.
    By jp16 in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 04-10-2019, 04:24 PM
  3. [SOLVED] Query Editor transforming Cross Tab data but Row header (date) become Text.
    By jp16 in forum Excel Charting & Pivots
    Replies: 8
    Last Post: 06-06-2018, 06:37 AM
  4. Query Editor - Json formating
    By TheVulcan in forum Excel General
    Replies: 0
    Last Post: 07-03-2017, 02:30 AM
  5. Join attributes in the query editor
    By jkk92 in forum Excel General
    Replies: 1
    Last Post: 03-19-2017, 02:15 PM
  6. [SOLVED] power query editor - unpivot?
    By pccamara in forum Excel General
    Replies: 5
    Last Post: 09-07-2016, 10:26 AM
  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