+ Reply to Thread
Results 1 to 7 of 7

Date Fromatting

  1. #1
    Registered User
    Join Date
    01-08-2020
    Location
    Toronto
    MS-Off Ver
    2010
    Posts
    72

    Date Fromatting

    Hi,

    I am trying to convert a date written in text to be formatted as MMM-YYYY.

    In the example attached I have tried to take the text date and using DATEVALUE convert it DD/MM/YYYY.

    The issue i'm having is one is in US format and the other in UK format. Is there anyway to change this.
    Attached Files Attached Files

  2. #2
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.84 for Mac MS 365
    Posts
    8,501

    Re: Date Fromatting

    is your first example 12/1/2017 supposed to be 1/12/2017 or 12/1/2017?
    Make contributors happy, click on the "* Add Reputation" as a way to say thank you.
    Sam Capricci

  3. #3
    Registered User
    Join Date
    01-08-2020
    Location
    Toronto
    MS-Off Ver
    2010
    Posts
    72

    Re: Date Fromatting

    the first example is MM/DD/YYYY, I am trying to change it to DD/MM/YYYY and also have MMM/YYYY

  4. #4
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Date Fromatting

    Try
    =--TRIM(MID(SUBSTITUTE(C4,"/",REPT(" ",10)),10,10)&"/"&LEFT(SUBSTITUTE(C4,"/",REPT(" ",10)),10)&"/"&RIGHT(C4,4))
    with cell formatted as mmm-yy
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  5. #5
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.84 for Mac MS 365
    Posts
    8,501

    Re: Date Fromatting

    for the examples provided, this appears to work...
    =IFERROR(DATEVALUE(TEXT(C4,"dd/mm/yyyy")),IF(ISNUMBER(C4),C4,DATE(MID(C4,FIND("/",C4,FIND("/",C4)+1)+1,LEN(C4)),LEFT(C4,FIND("/",C4)-1),MID(C4,FIND("/",C4)+1,(FIND("/",C4,FIND("/",C4)+1))-FIND("/",C4)-1))))

    I don't know what to make of your mmm/yyyy w/o an example AND an expected result.

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

    Re: Date Fromatting

    From what I have seen, the DATEVALUE() function uses your operating system regional settings to decide how to read a text date. In your case, I'm guessing that your system setting is set to a DMY date format, and so the DATEVALUE() function cannot understand MDY dates (or it will misunderstand them). I notice that, when I open your file (on a system set to MDY), it has not trouble with these text strings to date conversion.

    Rather than a formula like the others have proposed, I would probably use the text to columns command. At step 3 of the text import wizard, be sure to select the "Date" rate button and specify MDY dates (and D4 as the destination cell, if desired).

    Column E can then be a simple copy of column D (=D4 copied down) and formatted as "mmm-yyyy" to display "dec-2017". Remember that the underlying value is still the serial number for 1 dec 2017 (43070).
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  7. #7
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Date Fromatting

    MrShorty,
    I like your approach as long as you are sure of your data (i.e. that all the text dates in column C will convert to dates in the new format. If they don't, then excel will keep them in the same format (i.e mm/dd/yyyy) and not give an error.
    If the OP is sure that all of column C is correctly inputted as mm/dd/yyyy, as it appears to be, then I'd go with your method.

+ 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. Condtitonal fromatting (Formula)
    By pmw19800 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-25-2018, 08:32 AM
  2. Fromatting help
    By philiphampson1 in forum Excel General
    Replies: 2
    Last Post: 08-09-2018, 05:17 AM
  3. [SOLVED] Time Fromatting
    By Ron Purpura in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 06-05-2018, 02:33 PM
  4. Conditional Fromatting
    By PERLA1007 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 04-13-2016, 02:16 PM
  5. [SOLVED] Custome Number Fromatting HELP!
    By MG3 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 08-20-2015, 02:44 PM
  6. Conditional fromatting to another sheet...
    By Spitfire999 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 06-13-2007, 06:59 PM
  7. Conditional Fromatting and Formulas
    By Mark C via OfficeKB.com in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 10-25-2005, 10:05 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