+ Reply to Thread
Results 1 to 13 of 13

Date not formatting correctly

  1. #1
    Registered User
    Join Date
    07-22-2008
    Location
    WV
    Posts
    70

    Question Date not formatting correctly

    Hello all,

    My cells are formatted as dates in the format “March 6, 2016”. When I enter the date in that format it will display that way in the cell, but in the function bar it formats it as “03/06/2017”. For my purpose, I need them to all be in the “March 6, 2017” format in both the cell and the formula bar. I really don’t care if the cells are formatted as a date or text, but if I format the cells as text, many of the dates change to a five digit number that is not a date. I have also tried copying and pasting the data to a new sheet by only pasting the values, but then some values paste as a five digit number that is not a date.

    Attached is a copy of the file I am working with. Not all dates do this. Column A and most of column B show the correct format in the cell and formula bar, so look at column C and D to see the issue.

    Thanks
    Attached Files Attached Files

  2. #2
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Date not formatting correctly

    Hi,

    Why does it matter what is in the formula bar? If your cells contain actual dates, rather than text, the date will appear formatted in the formula bar based on your regional settings. If you want the two to be the same, you need to enter the dates as text, which will make them fairly useless for anything else you may wish to do with them in your workbook.
    Don
    Please remember to mark your thread 'Solved' when appropriate.

  3. #3
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Date not formatting correctly

    The formula bar displays the actual value in the cell without any formatting.

    In the case of a date it will appear in whatever format your system is set to use for dated.

    Why do you need the date in a specific format in the formula bar?

    It would be possible to do so but then you might have problems when trying to use the value in calculations/comparisons etc.
    If posting code please use code tags, see here.

  4. #4
    Valued Forum Contributor loginjmor's Avatar
    Join Date
    01-31-2013
    Location
    Cedar Rapids, Iowa
    MS-Off Ver
    Excel 2013
    Posts
    1,073

    Re: Date not formatting correctly

    Hi -

    Excel treats dates as a number starting with 1/1/1900 as the number 1, and counts up from there. So today's date is March 6, 2017 which is 42800 days after 1/1/1900. That's why when you paste a date to a cell that's formatted as a number you get a 5 digit number, like 42800. Excel does this so you can do math with dates and do comparisons of which date is later or earlier than another date.

    Hope that helps.
    ____________________________________________
    If this has solved your problem, please edit the thread title to add the word [SOLVED] at the beginning. You can do this by
    -Go to the top of the first post
    -Select Thread Tools
    -Select Mark thread as Solved

    If I have been particularly helpful, please "bump" my reputation by pressing the small star in the lower left corner of my post.

  5. #5
    Registered User
    Join Date
    07-22-2008
    Location
    WV
    Posts
    70

    Re: Date not formatting correctly

    Quote Originally Posted by xlnitwit View Post
    Hi,

    Why does it matter what is in the formula bar? If your cells contain actual dates, rather than text, the date will appear formatted in the formula bar based on your regional settings. If you want the two to be the same, you need to enter the dates as text, which will make them fairly useless for anything else you may wish to do with them in your workbook.
    I am connecting this to mapping software. The dates are the date the map was last revised and are listed dynamically on the map at the bottom when printed. The problem is that the dates show up on the map printout as the five digit numbers that display when the formatted is changed to text. I suppose it doesn't have to show in the formula bar as the same format as long as the map software shows the date as the same formatted shown in the cell. My main issue is why it shows some dates as a five digit number when the cells are formatted as text as that is the number that shows in the map software. I would rather just have it formatted as text to prevent any such display issues when the map software connects to it, but again, when I format as text many of the dates show as the five digit number.

  6. #6
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,481

    Re: Date not formatting correctly

    Hi there,

    The values you have entered in columns A and B are TEXT values, regardless of the fact that they "look like" dates and have been formatted as dates, and Excel is therefore unable to process them as date/numeric values - to see what I mean, add a numeric value (e.g. 7) to any cell in column A, and the result will be a #VALUE! error.

    Hope this helps,

    Regards,

    Greg M

  7. #7
    Registered User
    Join Date
    07-22-2008
    Location
    WV
    Posts
    70

    Re: Date not formatting correctly

    Quote Originally Posted by loginjmor View Post
    Hi -

    Excel treats dates as a number starting with 1/1/1900 as the number 1, and counts up from there. So today's date is March 6, 2017 which is 42800 days after 1/1/1900. That's why when you paste a date to a cell that's formatted as a number you get a 5 digit number, like 42800. Excel does this so you can do math with dates and do comparisons of which date is later or earlier than another date.

    Hope that helps.
    So any suggestions on how I could paste the values in the cell as text? The dates are linked to mapping software and the dates print at the bottom of the map to show when it was last revised. The problem is the map software displays the 5 digit number instead of the date. I just want the dates listed as text so the map software will display them correctly on the map printout. It's nice to understand why it shows a 5 digit number now though.
    Last edited by jambog; 03-06-2017 at 10:59 AM.

  8. #8
    Registered User
    Join Date
    07-22-2008
    Location
    WV
    Posts
    70

    Re: Date not formatting correctly

    Quote Originally Posted by Greg M View Post
    Hi there,

    The values you have entered in columns A and B are TEXT values, regardless of the fact that they "look like" dates and have been formatted as dates, and Excel is therefore unable to process them as date/numeric values - to see what I mean, add a numeric value (e.g. 7) to any cell in column A, and the result will be a #VALUE! error.

    Hope this helps,

    Regards,

    Greg M
    That makes sense, but is there a way to paste the dates as only text? I am fine with them all being text. As explained above to others, this is linked to map software that displays the contents of the cell, but the software it is linked to displays the dates as the 5 digit number instead of a date. I would think I could copy and paste the date as only values and it would paste the exact values shown in the cell, but it still pastes the 5 digit number for dates. It does not matter how they are formatted, text or date, as long as I can get rid of the underlying 5 digit number as that is the number that ends up printing when linked to my map software.

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

    Re: Date not formatting correctly

    You can use the =TEXT() function to convert any number to a text string in a specific number format. So, something like =TEXT(42800,"dd-mmm-yyyy") will return the text string "06-Mar-2017". You could then paste this into another text string, or use CONCATENATE() functions/operations to add the date as text into a larger text string.

    TEXT() function help file: https://support.office.com/en-us/art...8-93d29371225c
    Number format codes help file: https://support.office.com/en-us/art...2-09fab54be7f4
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  10. #10
    Registered User
    Join Date
    07-22-2008
    Location
    WV
    Posts
    70

    Re: Date not formatting correctly

    Quote Originally Posted by MrShorty View Post
    You can use the =TEXT() function to convert any number to a text string in a specific number format. So, something like =TEXT(42800,"dd-mmm-yyyy") will return the text string "06-Mar-2017". You could then paste this into another text string, or use CONCATENATE() functions/operations to add the date as text into a larger text string.

    TEXT() function help file: https://support.office.com/en-us/art...8-93d29371225c
    Number format codes help file: https://support.office.com/en-us/art...2-09fab54be7f4
    If I am understanding that correctly, I would have to create that formula for each 5 digit value, correct? So one formula for 42800, a separate formula for 42801, and so on. I may as well use find and replace, but either method is more time consuming that I would like. Thanks for the suggestions though.

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

    Re: Date not formatting correctly

    Quote Originally Posted by jambog View Post
    If I am understanding that correctly, I would have to create that formula for each 5 digit value, correct? So one formula for 42800, a separate formula for 42801, and so on. I may as well use find and replace, but either method is more time consuming that I would like. Thanks for the suggestions though.
    Yes, but, if the values are in a nice list like your sample shows, that should be as simple as entering the TEXT() formula once and copying the formula down as far as needed. Or perhaps there is a better way of entering the data into the spreadsheet, and resolve the problem at the data entry step.

    Your examples only show what the list might look like in Excel, with no discussion or example of how the date string is read by the mapping software and entered into the text string. Perhaps if we better understood what the mapping software was doing with the Excel data, something could be suggested.

    I think that, if we had a better understanding of the overall process (data entry into Excel -- data processing in Excel -- mapping software reading data in Excel -- mapping software processes excel data (concatenate into text string)), we might be able to make better suggestions.

  12. #12
    Registered User
    Join Date
    07-22-2008
    Location
    WV
    Posts
    70

    Re: Date not formatting correctly

    I am starting to suspect that this is a glitch in the mapping software (ArcMap).
    I've noticed some maps show the 5 digit number, some the format "03/06/2017" and some the "March 6, 2017" format,
    and it seems to happen at random. Still formatting all dates as text would be a work around as then ArcMap
    wouldn't have to "decide" which format to display (apparently at random), it would all be plain text. I suppose there is
    no way to do this though unless I retype them, find and replace or use formula =TEXT(42800, March 6, 2017)
    but I can not simply copy that formula down as the dates are not in consecutive order, many dates are skipped.

  13. #13
    Forum Expert
    Join Date
    03-20-2015
    Location
    Primarily UK, sometimes NL
    MS-Off Ver
    Work: Office 365 / Home: Office 2010
    Posts
    2,405

    Re: Date not formatting correctly

    It's easier to convert the 'true' dates (which are, to Excel, just numbers) to text than the other way round. So, try this:

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

    Drag this down as far as you need (E526 in your sample file). Then drag across to column H.
    You will now have all the same dates as in columns A-D, but all in text format.

    Does that help?
    Regards,
    Aardigspook

    I recently started a new job so am a bit busy and may not reply quickly. Sorry - it's not personal - I will reply eventually.
    If your problem is solved, please go to 'Thread Tools' above your first post and 'Mark this Thread as Solved'.
    If you use commas as your decimal separator (1,23 instead of 1.23) then please replace commas with semi-colons in your formulae.
    You don't need to give me rep if I helped, but a thank-you is nice.

+ 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. Cell linked to Microsoft MonthView Control not formatting date correctly.
    By jeffadvanced in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-26-2016, 05:08 PM
  2. [SOLVED] Date not formatting correctly
    By Plasma in forum Excel General
    Replies: 9
    Last Post: 05-06-2016, 02:30 PM
  3. [SOLVED] Correctly formatting a date inserted from an input box
    By dekueb in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 01-25-2016, 02:16 AM
  4. Conditional Formatting/Traffic LX style is not formatting correctly
    By christinembater in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-24-2014, 12:32 AM
  5. Date Not Formatting Correctly
    By sam8114 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-25-2013, 02:09 PM
  6. Formatting time correctly
    By nickatron in forum Excel General
    Replies: 1
    Last Post: 04-10-2011, 07:49 PM
  7. [SOLVED] numeric value is not formatting correctly
    By Fam via OfficeKB.com in forum Excel General
    Replies: 4
    Last Post: 02-02-2006, 12:25 PM

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