+ Reply to Thread
Results 1 to 10 of 10

Issue with change date format

  1. #1
    Registered User
    Join Date
    09-14-2017
    Location
    Dubai, United Arab Emirates
    MS-Off Ver
    Excel 2016
    Posts
    35

    Issue with change date format

    Hi All,

    I'm using the below formula to change the format of the the date in a certain cell to the correct one (setting the format of the column to dd-mmm-yy):
    =DATE(YEAR(RC[-1]),DAY(RC[-1]),MONTH(RC[-1]))
    [=DATE(YEAR(B88),DAY(B88),MONTH(B88)) in a real example]

    However after a certain line (when the day number is greater than 12) the formula gives incorrect as a result.
    I'm really puzzled and have no idea how to fix this. Please see a screen shot below:
    sample_date.JPG

    Have you experienced this before? How can I fix it?! It's driving me nuts!!

    Thanks a lot for your help and feedback in advance!
    Last edited by iadrika21; 09-17-2017 at 03:15 AM.

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,430

    Re: Issue with change date format

    Will you please attach a sample Excel workbook? We are not able to work with or manipulate a picture of one and nobody wants to have to recreate your data from scratch.

    1. Make sure that your sample data are REPRESENTATIVE of your real data. The use of unrepresentative data is very frustrating and can lead to long delays in reaching a solution.

    2. Make sure that your desired solution is also shown (mock up the results manually).

    3. Make sure that all confidential data is removed or replaced with dummy data first (e.g. names, addresses, E-mails, etc.).

    4. Try to avoid using merged cells as they cause lots of problems.

    Unfortunately the attachment icon doesn't work at the moment, so to attach an Excel file you have to do the following: just before posting, scroll down to Go Advanced and then scroll down to Manage Attachments. Now follow the instructions at the top of that screen.

    Please pay particular attention to point 2 (above): without an idea of your intended outcomes, it is often very difficult to offer appropriate advice.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,468

    Re: Issue with change date format

    Just out of interest, if all you're doing is changing the format of a date why are you using an additional column and this formula at all?

    Try swapping the day and month element of the formula around so it's Year/Month/Day.

    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Formula: copy to clipboard
    Please Login or Register  to view this content.

    BSB
    Last edited by BadlySpelledBuoy; 09-17-2017 at 03:21 AM.

  4. #4
    Registered User
    Join Date
    09-14-2017
    Location
    Dubai, United Arab Emirates
    MS-Off Ver
    Excel 2016
    Posts
    35

    Re: Issue with change date format

    Quote Originally Posted by AliGW View Post
    Will you please attach a sample Excel workbook? We are not able to work with or manipulate a picture of one and nobody wants to have to recreate your data from scratch.

    1. Make sure that your sample data are REPRESENTATIVE of your real data. The use of unrepresentative data is very frustrating and can lead to long delays in reaching a solution.

    2. Make sure that your desired solution is also shown (mock up the results manually).

    3. Make sure that all confidential data is removed or replaced with dummy data first (e.g. names, addresses, E-mails, etc.).

    4. Try to avoid using merged cells as they cause lots of problems.

    Unfortunately the attachment icon doesn't work at the moment, so to attach an Excel file you have to do the following: just before posting, scroll down to Go Advanced and then scroll down to Manage Attachments. Now follow the instructions at the top of that screen.

    Please pay particular attention to point 2 (above): without an idea of your intended outcomes, it is often very difficult to offer appropriate advice.
    Hi AliGW,
    Thanks a lot for the feedback! Attached a sample.

    C2 has the end result I would like to achieve.
    Column B is the data I pull from our system and its pulled in a "General" format. If I change the format to "Date", the cell data doesn't change automatically. If I click F2 + Enter, then it changes to "Date", but incorrect one (i.e. not to 2-Aug-17 as it should be, but 8-Feb-17). This incorrect data is represented in Column D (D2 - D25 I did F2+Enter so you can see the incorrect change, but left the rest untouched so you see that it doesn't change automatically)
    Column E has the data where I used the above formula. This does the job, but only where the day is equal or smaller then 12.

    Hope it is clear, please let me know if you would need further clarification.

    Thanks a lot for the help!
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    09-14-2017
    Location
    Dubai, United Arab Emirates
    MS-Off Ver
    Excel 2016
    Posts
    35

    Re: Issue with change date format

    Quote Originally Posted by BadlySpelledBuoy View Post
    Just out of interest, if all you're doing is changing the format of a date why are you using an additional column and this formula at all?

    Try swapping the day and month element of the formula around so it's Year/Month/Day.

    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Formula: copy to clipboard
    Please Login or Register  to view this content.

    BSB
    Nope, not working.
    Please see my comment to AliGW and also check the attached file.
    Attached Files Attached Files

  6. #6
    Forum Contributor shivya's Avatar
    Join Date
    08-19-2017
    Location
    Delhi, India
    MS-Off Ver
    2013
    Posts
    240

    Re: Issue with change date format

    There are many techniques to change the date format.
    Please attach your excel sheet with it.

    you can try:-
    1. Enter the formula =DATEVALUE(RIGHT(A1,2)&"-"&MID(A1,6,3)&"-"&LEFT(A1,4)) into the blank cell B1.
    2. Then tap the Enter key, select cell B1, and then drag the fill handle to the range you need.

    or

    =datevalue(A2)

    Use them, which is suitable otherwise please attach your excel sheet.

  7. #7
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,468

    Re: Issue with change date format

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    BSB

  8. #8
    Valued Forum Contributor Root_'s Avatar
    Join Date
    07-29-2017
    Location
    _
    MS-Off Ver
    2010+
    Posts
    484

    Re: Issue with change date format

    Quote Originally Posted by iadrika21 View Post
    ... However after a certain line (when the day number is greater than 12) the formula gives incorrect as a result...
    Try this:

    =--(RIGHT(B88,4)&"-"&MID(B88,4,2)&"-"&LEFT(B88,2))

  9. #9
    Registered User
    Join Date
    09-14-2017
    Location
    Dubai, United Arab Emirates
    MS-Off Ver
    Excel 2016
    Posts
    35

    Re: Issue with change date format

    Quote Originally Posted by shivya View Post
    There are many techniques to change the date format.
    Please attach your excel sheet with it.

    you can try:-
    1. Enter the formula =DATEVALUE(RIGHT(A1,2)&"-"&MID(A1,6,3)&"-"&LEFT(A1,4)) into the blank cell B1.
    2. Then tap the Enter key, select cell B1, and then drag the fill handle to the range you need.

    or

    =datevalue(A2)

    Use them, which is suitable otherwise please attach your excel sheet.
    Thank you!
    I ended up using =DATE(RIGHT(B6,4),MID(B6,4,2),LEFT(B6,2)) at the end which worked.

  10. #10
    Registered User
    Join Date
    09-14-2017
    Location
    Dubai, United Arab Emirates
    MS-Off Ver
    Excel 2016
    Posts
    35

    Re: Issue with change date format

    Quote Originally Posted by Root_ View Post
    Try this:

    =--(RIGHT(B88,4)&"-"&MID(B88,4,2)&"-"&LEFT(B88,2))
    Thank you!
    I ended up using =DATE(RIGHT(B6,4),MID(B6,4,2),LEFT(B6,2)) at the end which worked.

+ 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. Replies: 4
    Last Post: 04-29-2015, 08:36 AM
  2. date format issue n.2 pls help, thank you
    By cat3appr in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 12-26-2014, 12:52 PM
  3. [SOLVED] Date format issue
    By cmb80 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-01-2014, 07:16 AM
  4. [SOLVED] Issue with date format when comparing two date values (I'm in Australia)
    By aaron.irvine in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-08-2013, 01:13 AM
  5. Not able to change date format into proper excel date format
    By excel5111987 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-18-2011, 08:19 AM
  6. [SOLVED] DATE FORMAT issue
    By [email protected] in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 02-08-2006, 03:55 AM
  7. [SOLVED] Date format issue
    By Ian in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-28-2005, 01: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