+ Reply to Thread
Results 1 to 4 of 4

Converting Text Month, General Year and Day formats to recognizable date fields

  1. #1
    Registered User
    Join Date
    04-20-2015
    Location
    Utah
    MS-Off Ver
    Office 365
    Posts
    21

    Converting Text Month, General Year and Day formats to recognizable date fields

    I have a large amount of data exported from a SQL database. For analytic purpose in another report it is pulled with a column for Month, Year and Day. I use the DateValue function and concatenate to put them together in a standard date format that is actionable in other reports.
    I have tried the Date and Year functions to pull the information back out of the output from DateValue in a format that excel and PowerBI recognize as month and year but I am not getting proper results. I have tried formatting the columns with custom formats of YYYY, MMMM, DD but that doesn't seem to work.
    I am attaching a small sample of the data for reference. The SQL output gives me columns A, B, C. I put them together in standard date in column D. I would like to keep the same discreet data that is in A, B, C but have the month, year and day recognized as date values.
    Attached Files Attached Files

  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,933

    Re: Converting Text Month, General Year and Day formats to recognizable date fields

    What you need to understand about dates and times in excel is…

    a date is just a number representing the number of days passed since 1/1/900...and then formatted in a way that we recognize as a date. So, for instance, today (Fri 01 Jun 2018) is actually 43252

    Time is actually a decimal part of 1 (day), so 06:00 AM is 0.25, 12 noon is 0.5 and 18:00 (or 6 PM) is 0.75


    With that said, exactly how are you trying to pull the month and year out?
    You should be using =MONTH() and =YEAR()
    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
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: Converting Text Month, General Year and Day formats to recognizable date fields

    load A,B,C range to PowerQuery (PowerBI)
    select columns in order: Year, Month, Day
    Merge columns with custom delimiter: /
    change format to Date

    it will give you a date in your local format defined by the system
    if you want another format try : Using locale

    locale.jpg

  4. #4
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,199

    Re: Converting Text Month, General Year and Day formats to recognizable date fields

    Not sure I follow what you want:

    in D2

    =DATE(B2,MONTH(A2&0),C2)

    will give a standard Excel date

    To get YEAR

    =YEAR(D2)

    Similar for Month and Day

    to convert A2 to numeric Month

    =MONTH(A2&0)

+ 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. [SOLVED] Copy from general sheet to other sheets by month / year
    By Berna11 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 07-20-2017, 02:04 PM
  2. [SOLVED] Extract 2 corresponding fields by Date/Month/Year selection
    By suchetherrah in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 12-01-2015, 08:31 AM
  3. Replies: 2
    Last Post: 06-02-2015, 08:42 AM
  4. [SOLVED] Set Default Month and Year in a cell for entering date fields
    By kmahesh in forum Excel General
    Replies: 2
    Last Post: 07-26-2013, 11:17 PM
  5. Converting a day date to a month and year
    By Stu100 in forum Excel General
    Replies: 3
    Last Post: 10-16-2008, 08:02 AM
  6. Converting date to month/year and sorting
    By kmontgomery in forum Excel General
    Replies: 2
    Last Post: 03-05-2008, 06:37 PM
  7. Replies: 2
    Last Post: 05-21-2006, 03:35 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