+ Reply to Thread
Results 1 to 20 of 20

Date stored mixed in two different formats to convert to One single DD-MM-YYYY format..

  1. #1
    Registered User
    Join Date
    07-06-2014
    Location
    India
    MS-Off Ver
    2007
    Posts
    73

    Date stored mixed in two different formats to convert to One single DD-MM-YYYY format..

    Dear Sir,

    Please help.

    I have file with one column having 2 type of dates in mixed sequence.

    1. One type Stored as "General" format. I need to convert this to actual date format like "dd/mmm/yyyy".. Can any one help in this..

    The present data stored as under

    4/15/2015 12:00:00 AM
    11/30/2015 12:00:00 AM
    1/27/2016 12:00:00 AM

    2. Another type Stored as "custom format dd-mm-yyyy h:mm", data as under :

    01-04-2016 0:00
    12-08-2015 0:00

    Actually there is some error in entire data.

    I need to have these dates a 4-Jan-2016, 8-Dec-2015 with only one formula (i.e. "DD/MMM/YYYY") to be applied across column.

    How I convert.

    Thanks and Regards..

    Kundanlal

  2. #2
    Forum Expert
    Join Date
    02-19-2013
    Location
    India
    MS-Off Ver
    07/16
    Posts
    2,386

    Re: Date stored mixed in two different formats to convert to One single DD-MM-YYYY format

    it would be better if you could upload a sample book
    -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    WANT TO SAY THANKS, HIT ADD REPUTATION (*) AT THE BOTTOM LEFT CORNER OF THE POST

    More we learn about excel, more it shows us, how less we know about it.

    for chemistry
    https://www.youtube.com/c/chemistrybyshivaansh

  3. #3
    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,929

    Re: Date stored mixed in two different formats to convert to One single DD-MM-YYYY format

    It sounds like those are not really dates, but text that looks like dates - if that is the case, no amount of formatting will change that. Test them with =isnumber(cell-ref)...FALSE indicates they are text.

    See if this will help...
    A
    B
    5
    4/15/2015 12:00:00 AM*
    15/Apr/2015
    6
    11/30/2015 12:00 AM
    30/Nov/2015
    7
    1/27/2016 12:00 AM
    27/Jan/2016
    8
    1/4/2016 12:00 AM
    04/Jan/2016
    9
    12/8/2015 12:00 AM
    08/Dec/2015

    B5=IF(ISTEXT(A5),--LEFT(A5,FIND(" ",A5)-1),A5)
    copied down

    Then just format as needed
    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

  4. #4
    Forum Expert shukla.ankur281190's Avatar
    Join Date
    05-17-2014
    Location
    Lucknow, India
    MS-Off Ver
    Office 365
    Posts
    3,935

    Re: Date stored mixed in two different formats to convert to One single DD-MM-YYYY format

    try

    B1=IFERROR(DATEVALUE(MID(LEFT(A1,LEN(A1)-3),FIND("/",LEFT(A1,LEN(A1)-3))+1,2)&"/"&LEFT(LEFT(A1,LEN(A1)-3),FIND("/",LEFT(A1,LEN(A1)-3))-1)&"/"&MID(LEFT(A1,LEN(A1)-3),FIND(" ",LEFT(A1,LEN(A1)-3))-4,4)+0),A1)
    If I helped, Don't forget to add reputation (click on the little star ★ at bottom of this post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)

  5. #5
    Registered User
    Join Date
    07-06-2014
    Location
    India
    MS-Off Ver
    2007
    Posts
    73

    Re: Date stored mixed in two different formats to convert to One single DD-MM-YYYY format

    Thanks for help and suggestions..

    I have tried solution given by Mr. Shukla, it works properly on those cells which are stored as General.. I am attaching sample file where cells highlighted in Yellow shows wrong answers..

    Kindly help here as well..

    regards..

    Kundanlal
    Attached Files Attached Files

  6. #6
    Forum Expert shukla.ankur281190's Avatar
    Join Date
    05-17-2014
    Location
    Lucknow, India
    MS-Off Ver
    Office 365
    Posts
    3,935

    Re: Date stored mixed in two different formats to convert to One single DD-MM-YYYY format

    What would be expected result on highlighted cells??

    Once try

    =IFERROR(DATEVALUE(MID(LEFT(A3,LEN(A3)-3),FIND("/",LEFT(A3,LEN(A3)-3))+1,2)&"/"&LEFT(LEFT(A3,LEN(A3)-3),FIND("/",LEFT(A3,LEN(A3)-3))-1)&"/"&MID(LEFT(A3,LEN(A3)-3),FIND(" ",LEFT(A3,LEN(A3)-3))-4,4)+0),(MONTH(A3)&"/"&DAY(A3)&"/"&YEAR(A3))+0)

    or

    =IFERROR(DATEVALUE(MID(LEFT(A3,LEN(A3)-3),FIND("/",LEFT(A3,LEN(A3)-3))+1,2)&"/"&LEFT(LEFT(A3,LEN(A3)-3),FIND("/",LEFT(A3,LEN(A3)-3))-1)&"/"&MID(LEFT(A3,LEN(A3)-3),FIND(" ",LEFT(A3,LEN(A3)-3))-4,4)+0),(DAY(A3)&"/"&MONTH(A3)&"/"&YEAR(A3))+0)
    Last edited by shukla.ankur281190; 01-30-2016 at 03:40 AM.

  7. #7
    Registered User
    Join Date
    07-06-2014
    Location
    India
    MS-Off Ver
    2007
    Posts
    73

    Re: Date stored mixed in two different formats to convert to One single DD-MM-YYYY format

    Perfect..When applied for both the formats, the output is correct.. Many Thanks..

  8. #8
    Forum Expert shukla.ankur281190's Avatar
    Join Date
    05-17-2014
    Location
    Lucknow, India
    MS-Off Ver
    Office 365
    Posts
    3,935

    Re: Date stored mixed in two different formats to convert to One single DD-MM-YYYY format

    Glad it helps you and thanks for feedback.

    If you satisfy with any solution please add reputation by clicking * star icon left corner on your screen and mark thread as solved

  9. #9
    Forum Expert
    Join Date
    02-19-2013
    Location
    India
    MS-Off Ver
    07/16
    Posts
    2,386

    Re: Date stored mixed in two different formats to convert to One single DD-MM-YYYY format

    another way may be a little shorter approx 89 character short
    copy paste below in b3 and drag down

    =IFERROR(DATE(YEAR(A3),DAY(A3),DAY(MONTH(A3))),DATEVALUE(MID(A3,FIND("/",A3)+1,2)&"/"&LEFT(A3,FIND("/",A3)-1)&"/"&RIGHT(LEFT(A3,FIND(" ",A3)-1),4)))
    Attached Files Attached Files
    Last edited by hemesh; 01-30-2016 at 06:04 AM.

  10. #10
    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,929

    Re: Date stored mixed in two different formats to convert to One single DD-MM-YYYY format

    Did you even try my suggestion? It seems to work on all your dates?

    A
    B
    C
    D
    2
    TRDT
    3
    6/4/2015 0:00
    4/Jun/15
    6/4/2015 0:00
    6/4/2015 0:00
    4
    4/13/2015 12:00:00 AM 4/13/2015 12:00:00 AM
    4/13/2015 0:00
    4/13/2015 0:00
    5
    4/15/2015 12:00:00 AM 4/15/2015 12:00:00 AM
    4/15/2015 0:00
    4/15/2015 0:00
    6
    4/16/2015 12:00:00 AM 4/16/2015 12:00:00 AM
    4/16/2015 0:00
    4/16/2015 0:00
    7
    4/17/2015 12:00:00 AM 4/17/2015 12:00:00 AM
    4/17/2015 0:00
    4/17/2015 0:00
    8
    4/27/2015 12:00:00 AM 4/27/2015 12:00:00 AM
    4/27/2015 0:00
    4/27/2015 0:00
    9
    4/28/2015 12:00:00 AM 4/28/2015 12:00:00 AM
    4/28/2015 0:00
    4/28/2015 0:00
    10
    4/29/2015 12:00:00 AM 4/29/2015 12:00:00 AM
    4/29/2015 0:00
    4/29/2015 0:00
    11
    4/30/2015 12:00:00 AM 4/30/2015 12:00:00 AM
    4/30/2015 0:00
    4/30/2015 0:00
    12
    5/5/2015 0:00
    5/May/15
    5/5/2015 0:00
    5/5/2015 0:00
    13
    6/5/2015 0:00
    5/Jun/15
    6/5/2015 0:00
    6/5/2015 0:00
    14
    5/19/2015 12:00:00 AM 5/19/2015 12:00:00 AM
    5/19/2015 0:00
    5/19/2015 0:00

  11. #11
    Registered User
    Join Date
    07-06-2014
    Location
    India
    MS-Off Ver
    2007
    Posts
    73

    Re: Date stored mixed in two different formats to convert to One single DD-MM-YYYY format

    Yes Sir.. I tried this as well.. But at my end I am getting some error .. output was as under

    04-09-2015 0:00 4-Sep-15 It correctly converted for this input
    4/16/2015 12:00:00 AM #VALUE! Showing error here..

  12. #12
    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,929

    Re: Date stored mixed in two different formats to convert to One single DD-MM-YYYY format

    hmm my sample that I posted here was copied from your file with my formula applied, see the attached
    Attached Files Attached Files

  13. #13
    Registered User
    Join Date
    07-06-2014
    Location
    India
    MS-Off Ver
    2007
    Posts
    73

    Re: Date stored mixed in two different formats to convert to One single DD-MM-YYYY format

    When I edited formula, it is giving error #Value!..

  14. #14
    Forum Expert
    Join Date
    02-19-2013
    Location
    India
    MS-Off Ver
    07/16
    Posts
    2,386

    Re: Date stored mixed in two different formats to convert to One single DD-MM-YYYY format

    @kundan Which formula You are referring to.

  15. #15
    Registered User
    Join Date
    07-06-2014
    Location
    India
    MS-Off Ver
    2007
    Posts
    73

    Re: Date stored mixed in two different formats to convert to One single DD-MM-YYYY format

    The one which is present in book1.xls, a solution provided by FDibbins..Thanks..

  16. #16
    Forum Expert
    Join Date
    02-19-2013
    Location
    India
    MS-Off Ver
    07/16
    Posts
    2,386

    Re: Date stored mixed in two different formats to convert to One single DD-MM-YYYY format

    Ok, what you are trying to change

  17. #17
    Registered User
    Join Date
    07-06-2014
    Location
    India
    MS-Off Ver
    2007
    Posts
    73

    Re: Date stored mixed in two different formats to convert to One single DD-MM-YYYY format

    When tried to use in another file it shows error. Also when tried to edit in same cell, it gives error..

  18. #18
    Registered User
    Join Date
    07-06-2014
    Location
    India
    MS-Off Ver
    2007
    Posts
    73

    Re: Date stored mixed in two different formats to convert to One single DD-MM-YYYY format

    =IF(ISTEXT(A11),--LEFT(A11,FIND(" ",A11)-1),A11)

    4/30/2015 12:00:00 AM #VALUE! Gives error here when copied to another cell and tried to correct A11 as cell ref.
    05-05-2015 0:00 05-05-2015 0:00 It do not give error here..

  19. #19
    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,929

    Re: Date stored mixed in two different formats to convert to One single DD-MM-YYYY format

    Which version of excel are you trying to use this on?

  20. #20
    Registered User
    Join Date
    07-06-2014
    Location
    India
    MS-Off Ver
    2007
    Posts
    73
    Quote Originally Posted by FDibbins View Post
    Which version of excel are you trying to use this on?
    Excel 2007

+ 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] mixed date formats in s/s, how to format
    By cal_chica in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 12-16-2014, 06:22 PM
  2. [SOLVED] How to Convert date format ( DD/MM/YYYY) into MM/YYYY
    By PRADEEPB270 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-04-2014, 07:25 AM
  3. convert date in yyyy/mm/dd format
    By abraham30 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 12-12-2013, 05:40 AM
  4. [SOLVED] Convert date format to (dd/mm/yyyy)
    By nur2544 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 07-11-2013, 09:40 AM
  5. [SOLVED] Automatically convert Date format M/D/YYYY TO DD/MM/YY
    By satputenandkumar0 in forum Excel General
    Replies: 11
    Last Post: 11-26-2012, 08:26 AM
  6. [SOLVED] Convert Date Format from yyyy-mm-dd to dd mmm yy using VBA
    By longbow007 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-25-2012, 07:36 AM
  7. [SOLVED] Imported data contains strings dd.mm.yyyy how can I convert to date format dd/mm/yyyy inVB
    By Boormo in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 09-05-2012, 05:48 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