+ Reply to Thread
Results 1 to 16 of 16

Date Conversion (19XX to 20XX)

  1. #1
    Registered User
    Join Date
    05-31-2013
    Location
    Washington, DC
    MS-Off Ver
    Excel 2010
    Posts
    3

    Date Conversion (19XX to 20XX)

    I was converting a Word document to Excel and the dates (MM/DD/YY) were transferred as text and had the error notification. I tried to remedy this by accepting error help and modifying the dates to the respective 4 year format (19XX, 20XX). We are talking about a lot of data here (about 650 pages). I messed up somewhere because now a lot of my dates that should have been 20XX are now 19XX. The error is no longer being recognized but I need to change most of the 19XX dates to 20XX dates. Is there a macro I can run to do this all in one shot? I need all years between 1900 and 1913 to be changed to 2000-2013. Any help would be greatly appreciated!

  2. #2
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Date Conversion (19XX to 20XX)

    I guess you could use this formula:
    =IF(AND(A1<=DATE(1913,12,31),A1>=DATE(1900,1,1)),A1+36525,A1)

    Can put a macro together put I'd need an example workbook showing what everything looks like

  3. #3
    Valued Forum Contributor wenqq3's Avatar
    Join Date
    04-01-2013
    Location
    Malaysia
    MS-Off Ver
    Excel 2003
    Posts
    868

    Re: Date Conversion (19XX to 20XX)

    Hi Bluendedmoon,
    Since you saying 650 worksheet, can you upload 1 worksheet with date only.
    So i can write a macro for you to change the date.
    -If the problem is solved, please mark your thread as Solved: Click Thread Tools above your first post, select "Mark your thread as Solved".

    -Always upload a workbook before start your question
    To attach a file, push the button with the paperclip (or scroll down to the Manage Attachments button), browse to the required file, and then push the Upload button.

    +++ If my answer(s) helped you, please add me reputation by click on * +++

  4. #4
    Registered User
    Join Date
    05-31-2013
    Location
    Washington, DC
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Date Conversion (19XX to 20XX)

    Here is a sample of the document I'm working with. Thank you so much!
    Attached Files Attached Files

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

    Re: Date Conversion (19XX to 20XX)

    To continue with yudlugar's excellent suggestion, you could then Copy the results of your formula (i.e. select column B> Copy) and Paste Special> Values back on top of column A. Then clear column B.
    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

  6. #6
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Date Conversion (19XX to 20XX)

    As a macro:
    Please Login or Register  to view this content.

  7. #7
    Valued Forum Contributor wenqq3's Avatar
    Join Date
    04-01-2013
    Location
    Malaysia
    MS-Off Ver
    Excel 2003
    Posts
    868

    Re: Date Conversion (19XX to 20XX)

    Please Login or Register  to view this content.
    Please set the range, and you have many worksheets in one workbook,so it take long time.

  8. #8
    Registered User
    Join Date
    05-31-2013
    Location
    Washington, DC
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Date Conversion (19XX to 20XX)

    This formula worked like a charm and was a lifesaver! Thank you everyone.

  9. #9
    Registered User
    Join Date
    05-16-2017
    Location
    Winterfell, The North
    MS-Off Ver
    MS Office 2016
    Posts
    4

    Re: Date Conversion (19XX to 20XX)

    Hi guys,
    I am facing the same problem with dates.
    For example, I would like to change 08-Jan-17 into 1/8/2017. I tried recording a macro to see how I could select the option "convert XX to 20XX" offered in the box (see attached), but nothing came out of it.

    Screen Shot 2017-05-16 at 9.56.05 AM.png.
    I have to do this modification in Column C on over 10 thousands lines.
    Would someone have a code for this?
    Thanks!

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

    Re: Date Conversion (19XX to 20XX)

    What is the default format for dates in your region, m d yy or d m yy?
    Is 08-Jan-17 text or a number? (To find out, in another cell, enter this formula =ISNUMBER(A1) where A1 is the cell your date is in. It should give a "TRUE" answer.

    If the answer is true, simply select the cell and Format Cells> Number> Date and find the format you want.

  11. #11
    Registered User
    Join Date
    05-16-2017
    Location
    Winterfell, The North
    MS-Off Ver
    MS Office 2016
    Posts
    4

    Re: Date Conversion (19XX to 20XX)

    Hi ChemistB,

    The default format is dd-mmm-yy.
    08-Jan-17 is not a number. The only thing making things complicated is that warning sign that appears when I try to convert all the date in the following format: mm/dd/yyyy. I would need to convert XX to 20XX as default for the rest of the dates I want to modify.
    I cannot find a macro to do that anywhere.

    Thanks!

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

    Re: Date Conversion (19XX to 20XX)

    Can you upload an example spreadsheet

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.

  13. #13
    Registered User
    Join Date
    05-16-2017
    Location
    Winterfell, The North
    MS-Off Ver
    MS Office 2016
    Posts
    4

    Re: Date Conversion (19XX to 20XX)

    See example attached.

    The beginning contains the dates in the right format. Format to modify comes in at row 159.

    Thanks!
    Attached Files Attached Files

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

    Re: Date Conversion (19XX to 20XX)

    Try something like
    For month day year
    =(MID(B160,FIND("-",B160)+1,3)&" "&LEFT(B160,2)&", 2017")+0
    For day month year
    =(Left(B160,2) &"-" & MID(B160, FIND("-", B160)+1, 3) & "-2017")+0
    Do either of those work?

  15. #15
    Registered User
    Join Date
    05-16-2017
    Location
    Winterfell, The North
    MS-Off Ver
    MS Office 2016
    Posts
    4

    Re: Date Conversion (19XX to 20XX)

    That first formula works well. I am curious about what +0 does?

    I am wondering how I could integrate this into a macro with a loop without using any .select.

    Thank you for your help so far!

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

    Re: Date Conversion (19XX to 20XX)

    The LEFT and MID functions are made to manipulate text strings so Excel sees any result from that as a string. The +0 helps Excel see it as a number.

    I would start a new post, probably in the "Excel Programming/VBA forum asking for a macro to do what you want to do. Include your workbook so they know what they are working with.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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