1

I have a bunch of cells (coming from a CSV file) containing text like:

Dec 29, 2018
Dec 30, 2018

I have already applied the desired format to these cells, so that they are displayed like this:

29-Dec-2018
30-Dec-2018

Problem: Excel does not automatically recognize the dates / apply the date format. I need to do F2 then Enter on each cell for it to be displayed as I want.

How can I automatically force Excel to apply the format on the whole range of cells ? (I hope there's a smarter way than a macro...)

4
  • Are you opening the CSV file directly with Excel or are you importing it into a tab in an Excel workbook?
    – Excellll
    Jan 11, 2019 at 17:30
  • Two easy ways could achieve this: 1) use the format painter tool - Copy from one cell and apply to the ones you have imported 2) Use formulas (DAY, MONTH,YEAR functions) and reassemble the date to your desired format
    – Eric F
    Jan 11, 2019 at 17:33
  • @Excellll I opened the CSV.
    – Sébastien
    Jan 14, 2019 at 9:37
  • @EricF 1/ Does not work. The cell format is already correct, it's just that it's not applied as long as the text is not recognized as a date 2/ Is not applicable as the date is not recognized
    – Sébastien
    Jan 14, 2019 at 9:39

1 Answer 1

4

Use the replace tool.

  1. Select the column with the Date
  2. Replace (Its CTRL+U in PTBR, but CTRL+F in US version)
  3. Replace something with itself (Are all the dates 2018? Replace 2018 with 2018 or 20 with 20)

By doing this, Excel will run on every cell replacing the value with itself, effectively updating the value on the cell. It will identify it is a date and it should work. If it doesn't, try formatting the cells with a General type and trying again.

4
  • Nice trick, does the job. I wish Excel would offer a cleaner way to achieve this, though.
    – Sébastien
    Jan 14, 2019 at 9:40
  • Is there a way to do this programmatically (preferably in PowerQuery)?
    – ikaerom
    Feb 6 at 18:40
  • @ikaerom There are ways to deal with this via Macro inside the Excel source, but this question specifically asked for something not macro related. For Powerquery, you would possibly use something like 'Date.FromText', but I recommend opening a question for further information.
    – Moacir
    Feb 7 at 19:55
  • 1
    @Moacir Indeed, I figured it out using a Date.FromText() approach today.
    – ikaerom
    Feb 7 at 19:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .