+ Reply to Thread
Results 1 to 25 of 25

how to prevent date format change

  1. #1
    Registered User
    Join Date
    07-26-2010
    Location
    Singapore
    MS-Off Ver
    Excel 2021
    Posts
    43

    how to prevent date format change

    I am having problems with excel when I am input dates.

    For example, if I input 17/01/11 into a cell, sometimes it appears as 01/17/11 or 17 01 11 or ###########

    1) Is there a way so that what ever I input will be the same forever? For example if I input 17/01/11 is will appear as 17/01/11. If I input 17 Jan 11, it will appear as 17 Jan 11. I want to prevent excel from auto changing to other formats

    2) I want to search the cell that contains the word Jan (or other months). So after searching I want to highlight the cell (or maybe if possible highlight the row) so that I can easily identify the rows with Jan. How can I do it?

    3) Is there a way to sort rows by date? In my sheet, every row has a column that contains a date and there is another column that has a number for each row,
    Somtimes I want to sort by date Jan on top most and Dec bottom most and sometimes I want to sort the row with the number 1 on top most and row with number 100 at the bottom most.
    (Please advise me what is the best format to to enter dates as if I want to sort it frequently, I think format like 17/01/11 is more confusing as the date and month might be messed up. 17 Jan 11 looks better)

    Thanks a lot.

  2. #2
    Registered User
    Join Date
    07-26-2010
    Location
    Singapore
    MS-Off Ver
    Excel 2021
    Posts
    43

    Re: how to prevent date format change

    Just to add more info

    My data sample will be.

    columnA columnB columnC columnD columnE
    1 apple red ripe 17 Jan 11
    2 orange orange rotten 22 Aug 10
    3 papaya orange bad 02 Mar 08
    4 lime green good 20 Jan 07
    5 grapes green good 23 Jan 11


    Sometimes I would like to see rows arranged by column A from smallest number on top to biggest number at bottom (as seen in sample data above)

    Sometimes I would like to arrange by column E by the months, so I would like to sort all the Jan rows to the top.If possible, I would like to sort the years and date too, with most smaller number years and smaller dates to the top.

    Sample result if I sort for the term Jan

    columnA columnB columnC columnD columnE
    4 lime green good 20 Jan 07
    1 apple red ripe 17 Jan 11
    5 grapes green good 23 Jan 11
    2 orange orange rotten 22 Aug 10
    3 papaya orange bad 02 Mar 08

  3. #3
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: how to prevent date format change

    Have you tried formatting Column E

    Format > Format Cells Number > Custom "dd mmm yy" (without the quotes)

    Hope this helps
    If you need any more information, please feel free to ask.

    However,If this takes care of your needs, please select Thread Tools from menu above and set this topic to SOLVED. It helps everybody! ....

    Also
    اس کی مدد کرتا ہے اگر
    شکریہ کہنے کے لئے سٹار کلک کریں
    If you are satisfied by any members response to your problem please consider using the small Star icon bottom left of their post to show your appreciation.

  4. #4
    Registered User
    Join Date
    07-26-2010
    Location
    Singapore
    MS-Off Ver
    Excel 2021
    Posts
    43

    Re: how to prevent date format change

    Quote Originally Posted by Marcol View Post
    Have you tried formatting Column E

    Format > Format Cells Number > Custom "dd mmm yy" (without the quotes)

    Hope this helps
    I tried it and most of the rows do appear as 17 Jan 11 format, some of the rows still remains as 25/01/2011 format.

  5. #5
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: how to prevent date format change

    Try this, I suspect that some dates are in Text format.

    Select the affected range

    Text to columns > Delimited >Next > Next > Date:=DMY > Finish.

    Then format the selection
    Format > Format Cells Number > Custom "dd mmm yy" (without the quotes)

  6. #6
    Registered User
    Join Date
    07-26-2010
    Location
    Singapore
    MS-Off Ver
    Excel 2021
    Posts
    43

    Re: how to prevent date format change

    You solution in the previous reply works great. Exactly what I wanted. Thanks a lot!

    One more question... how can I arrange the months that I want to see to the top?

  7. #7
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: how to prevent date format change

    What months to the top of where....

    You would do best to post a sample workbook showing your Sheet Layout and perhaps Before and After examples.

    It should clearly illustrate your problem and not contain any sensitive data.

  8. #8
    Registered User
    Join Date
    07-26-2010
    Location
    Singapore
    MS-Off Ver
    Excel 2021
    Posts
    43

    Re: how to prevent date format change

    A sample and the result I wanted in posted in my post #2 as seen in this thread.

    Basically my worksheet has different rows with different dates in different rows, if I want to see the month Jan, I would like all the rows that contain the word Jan to be sorted to the top, so I can see what are the items that are going to due in Jan easily instead of scanning through the whole worksheet looking for rows that contain the word Jan in columnE

    Thanks.

  9. #9
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: how to prevent date format change

    try another column say F in f2 put

    =TEXT(E2,"mmm")&"-"&YEAR(E2)
    then use auto filter to display say feb-2011
    Attached Files Attached Files
    Last edited by martindwilson; 01-29-2011 at 10:06 AM.
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  10. #10
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: how to prevent date format change

    Slightly different from martin

    In F2 (helper column)
    Please Login or Register  to view this content.
    Drag/Fill Down

    Sort A:F (Two conditions)
    By:= Helper Column > Ascending
    Then by:= Date > Ascending

    Then apply filter to Helper Column:= "Jan"

    Hope this helps

    Tip:=Posting a sample workbook, rather than some text in your post, is always an advantage.
    Attached Files Attached Files

  11. #11
    Registered User
    Join Date
    07-26-2010
    Location
    Singapore
    MS-Off Ver
    Excel 2021
    Posts
    43

    Re: how to prevent date format change

    Quote Originally Posted by martindwilson View Post
    try another column say F in f2 put

    =TEXT(E2,"mmm")&"-"&YEAR(E2)
    then use auto filter to display say feb-2011
    how do you add the box E1 to have have the autofilter / dropdown menu?

    from your auto filter dates.xls I can see the dropdown box for E1 has Jan-2011, Feb-2011, Mar-2011 to select (tick) from, how can I see the other months?

  12. #12
    Registered User
    Join Date
    07-26-2010
    Location
    Singapore
    MS-Off Ver
    Excel 2021
    Posts
    43

    Re: how to prevent date format change

    Quote Originally Posted by Marcol View Post
    Slightly different from martin

    In F2 (helper column)
    Please Login or Register  to view this content.
    Drag/Fill Down

    Sort A:F (Two conditions)
    By:= Helper Column > Ascending
    Then by:= Date > Ascending

    Then apply filter to Helper Column:= "Jan"

    Hope this helps

    Tip:=Posting a sample workbook, rather than some text in your post, is always an advantage.
    I understand that you fill in F2 with =TEXT(E3,"mmm") then drag/fill down.

    How do you do the following steps?
    Sort A:F (Two conditions)
    By:= Helper Column > Ascending
    Then by:= Date > Ascending

    Then apply filter to Helper Column:= "Jan"


    In the F1 cell, I can select either Aug, Jan, Mar, how can I add more months?


    How do you make the F1 cell with the drop down menu?


    Thanks for your patience. I am a beginner, so some things that you mentioned I may not know what are the steps to do to achieve it.

  13. #13
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: how to prevent date format change

    the other months aren't on there yet auto filter will show only what it can see put some more dates in column E and drag the formula down, in col F
    to use auto filter on column F
    home tab/sort and filter choose filter

  14. #14
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: how to prevent date format change

    See if following the steps in this pdf helps.
    Attached Files Attached Files

  15. #15
    Registered User
    Join Date
    07-26-2010
    Location
    Singapore
    MS-Off Ver
    Excel 2021
    Posts
    43

    Re: how to prevent date format change

    Quote Originally Posted by Marcol View Post
    See if following the steps in this pdf helps.
    Your pdf is clear. I can understand now. Thanks for the explanation

    As I followed along the pdf, after I clicked sort, in the "Sort by" dropdown box, it shows Column A, Column B, Column C, instead of the titles of the first row like helper Column, Date. Why is it so?

    I noticed there are 2 ways to reach the sort button, is there a difference between the sort in
    1. Home tab>Sort&Filter
    2. Data tab>Sort

  16. #16
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: how to prevent date format change

    1/. I only put one header ("Helper Column") in the example in row1, as Excel can only read what is there it will identify other columns as Column A, B, etc... Fill in the rest of the headers and Excel will read them.

    2/. Both are the same, The first 2 options in sort by the first highlighted column, the third option, Home > Custom, is exactly the same as Data > Sort.
    Note that both tabs have the same options, Home uses a dropdown selection, Data uses Icons.

    I almost invariably use Data > Sort or Home > Sort&Filter > Custom, this allows the option to specify whether the hilighted table has headers or not.

    Play about with the options, highlight parts of the table to see the options and warnings.

  17. #17
    Registered User
    Join Date
    07-26-2010
    Location
    Singapore
    MS-Off Ver
    Excel 2021
    Posts
    43

    Re: how to prevent date format change

    Quote Originally Posted by Marcol View Post
    1/. I only put one header ("Helper Column") in the example in row1, as Excel can only read what is there it will identify other columns as Column A, B, etc... Fill in the rest of the headers and Excel will read them.
    I do not get it.

    If I start a new blank sheet, filled in A1 with id, B1 with fruit, C1 with color, D1 with condition, E1 with date, F1 with helper column. I selected the whole sheet. Then I go to Data>Sort. In the dropdown box of "Sort by", I would see Column A, Column B, Column C, Column D...

    I do not see the headers name.

  18. #18
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: how to prevent date format change

    I do not get it.
    Neither do I.....
    Try this workbook.
    Attached Files Attached Files

  19. #19
    Registered User
    Join Date
    07-26-2010
    Location
    Singapore
    MS-Off Ver
    Excel 2021
    Posts
    43

    Re: how to prevent date format change

    This is what I mean in thread #17. Refer to attached pic
    Attached Images Attached Images

  20. #20
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: how to prevent date format change

    If you only select one row, what do you expect Excel to sort? It can sort Left to Right if you select Options...., but that is not what you are after in this case.

    Select more than one row say range A1 to F2 select sort and you will be able to sort by Column A, Column B, Column C,...etc.
    Now check the checkbox "My Data Has Headers" and see the result in the sort by dropdown.

    Toggle the check-box on and off and watch the selected range change.

    Try this link for the basics of "Sort Data", it's for 2003, but you should be able follow it
    http://www.contextures.com/xlSort01.html

    This thread has gone so far off topic "how to prevent date format change" I feel it should be ended now.

  21. #21
    Registered User
    Join Date
    07-26-2010
    Location
    Singapore
    MS-Off Ver
    Excel 2021
    Posts
    43

    Re: how to prevent date format change

    I understand what you mean now.

    Just one more question. Is it possible to have my headers on row 2? And let the headers appear in the "Sort by" after I checked the check box "My Data Has Headers"

    I am using Row 1 for a title and a brief description of the sheet, so my headers will be on row 2.

    Thanks

  22. #22
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: how to prevent date format change

    Why don't you just try it and see?
    You can sort/filter any range you choose to select.

    I'm sorry, but short of coming to Singapore and doing it for you, I can't see how I can help you any more.

  23. #23
    Registered User
    Join Date
    07-26-2010
    Location
    Singapore
    MS-Off Ver
    Excel 2021
    Posts
    43

    Re: how to prevent date format change

    Quote Originally Posted by Marcol View Post
    Why don't you just try it and see?
    You can sort/filter any range you choose to select.

    I'm sorry, but short of coming to Singapore and doing it for you, I can't see how I can help you any more.
    I think just forget about the last question. Its ok. I find excel always use the first row as the header. I did not figure out how to use the 2nd row as the header. I guess I will just delete the first row, so that the header description can occupy the first row, and the "sort by" will display the headers description.

    Thanks for your time. I appreciate it.

  24. #24
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: how to prevent date format change

    Select the whole range of Data including the headers, and drag it anywhere in the sheet
    With the range still selected go to Data > Sort (or Filter) and do as explained earlier.

  25. #25
    Registered User
    Join Date
    07-26-2010
    Location
    Singapore
    MS-Off Ver
    Excel 2021
    Posts
    43

    Re: how to prevent date format change

    This is what I have noticed, whatever cells I have selected, when I go to Data > Sort, it will always use the top most row as the header and the header description will be displayed in the "sort by" dropdown box

    If i understand your reply correctly, it means that I do not select the first row.

    (In my sheet, The first row is a sentence with the words "This sheet contains details of fruits."
    From the second row onwards, it is like the rows as seen in Book1_rowrow.xls )

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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