0

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...)

  • Are you opening the CSV file directly with Excel or are you importing it into a tab in an Excel workbook? – Excellll Jan 11 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 at 17:33
  • @Excellll I opened the CSV. – Sébastien Jan 14 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 at 9:39
1

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.

  • Nice trick, does the job. I wish Excel would offer a cleaner way to achieve this, though. – Sébastien Jan 14 at 9:40

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.