excel date formatting not working

后端 未结 12 3162
-上瘾入骨i
-上瘾入骨i 2021-02-20 15:13

I have an excel sheet created by a 3rd party program.

One of the columns has dates in this format: \"Jan 19, 2015 03:00:00 PM\"

I would like these dates to appea

相关标签:
12条回答
  • 2021-02-20 15:22

    The only way to solve this is to:

    upload the Excel sheet to Google Drive. On Google Drive do this:

    click to open the file with Google spreadsheet

    Once it has opened as a Google spreadsheet, select the entire column with dates.

    select the format type to Date (you can choose any format of date you want).

    Download the Google spreadsheet as .xlsx. All the contents of the column are now dates

    0 讨论(0)
  • 2021-02-20 15:23

    The following worked for me:

    • Select the date column.
    • Go to the Data-tab and choose "Text to Columns".
    • On the first screen, leave radio button on "delimited" and click Next.
    • Unselect any delimiter boxes (everything blank) and click Next.
    • Under column data format choose Date
    • Click Finish.

    Now you got date values

    0 讨论(0)
  • 2021-02-20 15:28

    While you didn't tag VBA as a possible solution, you may be able to use what some feel is a VBA shortcoming to your advantage; that being VBA heavily defaulted to North American regional settings unless explicitly told to use another.

    Tap Alt+F11 and when the VBE opens, immediately use the pull down menus to Insert ► Module (Alt+I,M). Paste the following into the pane titles something like Book1 - Module1 (Code).

    Sub mdy_2_dmy_by_Sel()
        Dim rDT As Range
        With Selection
            .Replace what:=Chr(160), replacement:=Chr(32), lookat:=xlPart
            .TextToColumns Destination:=.Cells(1, 1), DataType:=xlFixedWidth, FieldInfo:=Array(0, 1)
            For Each rDT In .Cells
                rDT = CDate(rDT.Value2)
            Next rDT
            .NumberFormat = "dd/mm/yyyy"
        End With
    End Sub
    

    Tap Alt+Q to return to your worksheet. Select all of the dates (just the dates, not the whole column) and tap Alt+F8 to Run the macro.

    Note that both date and time are preserved. Change the cell number format if you wish to see the underlying times as well as the dates.

    0 讨论(0)
  • 2021-02-20 15:29

    My solution to a similar problem with Date formatting was solved by:

    1. Copying the problem sheet then pasting it into Sheet
      n.
    2. Deleting the problem sheet.
    3. Renaming Sheet n to the name of the problem sheet.

    QED.

    The problem sheet contained Date data that I wanted to read as 07/21/2017 that would not display anything other than 42937. The first thing I did was to close Excel and re-launch it. More tries followed. I gave up on my own solutions. I tried a few online suggestions. I then made one more attempt and - Walla - the above three steps fixed the problem. As to why the problem existed? It obviously had something to do with "the" sheet. Go figure!

    For me to believe is insufficient for you to know - rodalsa.

    0 讨论(0)
  • 2021-02-20 15:30

    Given your regional settings (UK), and the inability of formatting to change the date, your date-time string is text. The following formula will convert the date part to a "real" date, and you can then apply the formatting you wish:

    =DATE(MID(A1,FIND(",",A1)+1,5),MATCH(LEFT(A1,3),{"Jan";"Feb";"Mar";"Apr";"May";"Jun";"Jul";"Aug";"Sep";"Oct";"Nov";"Dec"},0),MID(SUBSTITUTE(A1,",","   "),5,5))
    

    Might be able to simplify a bit with more information as to the input format, but the above should work fine. Also, if you need to retain the Time portion, merely append:

    +RIGHT(A1,11)
    

    to the above formula.

    0 讨论(0)
  • 2021-02-20 15:30

    Similar way as ron rosefield but a little bit simplified.

    =DATE(RIGHT(A1,4),MATCH(MID(A1,4,2),{"01";"02";"03";"04";"05";"06";"07";"08";"09";"10";"11";"12"},0),LEFT(A1,2))

    0 讨论(0)
提交回复
热议问题