I have a spreadsheet with existing date values that I'd like to convert from MM/DD/YYYY to DD/MM/YYYY format. Is there any way of doing this?
The spreadsheet comes from a csv file from someone else that i have opened in calc.
I have a spreadsheet with existing date values that I'd like to convert from MM/DD/YYYY to DD/MM/YYYY format. Is there any way of doing this?
The spreadsheet comes from a csv file from someone else that i have opened in calc.
Select the cells with the dates and in Cell -> Format
, choose the date format you wish (DD/MM/YYYY
)
Making sure the cells are selected, go to Data -> Text to columns
choose "Separated by" and "Tab" and click "OK"
Cells should now have the desired format
Cut (or copy then erase) all values from the column (CTRL + X).
Choose Edit -> Paste Special -> Unformatted text (MAJ + CTRL + ALT + V).
On "Fields", click on your column, then select "Date (MDY)". It is important here to select the format the data currently is, NOT the format you want it to be.
If date is still not OK, you will need to follow this additional step (response above from @cybernetic.nomad):
- Select the cells with the dates and in Cell -> Format, choose the date format you wish (DD/MM/YYYY).
NB: Note that my LibreOffice Calc is not in english so I am not 100% sure about the option names.
You select the cells to format, then you press Ctrl-1 (or choose "Format" - "Cells..." from the menu, or any other way) to open the dialog to format cells. There is a text field "Format code" where you enter "DD/MM/YYYY" without the quotation marks. Click "OK".
If that does not format the date like you want, the value in the cell is not interpretable as a date. Investigate the cell's value, you might have a text marker (a single apostrophe ') as the first character.
To check this out and experiment with the formats, choose "Insert" - "Date" from the menu. It puts the current date into the current cell.
Disclaimer: Since my Calc is not set to English, the names of menus and their entries might be different. I just guessed how they could be named.
EDIT:
If you can't change the cell format because the date is constantly recognized as "text", you might like to try this:
O
. All columns right of it are pushed to the right.Put this formula in cell O2
on the right of the first date text:
=CONCATENATE(MID(N2;4;3);MID(N2;1;3);MID(N2;7;4))
It takes snippets (MID()
) from cell N2
and concatenates them in the new order. Details of the functions are in Calc's documentation.
You will need to adjust N2
to the correct cell reference if it is not the cell directly left of the cell you're entering the formula.
Put the cell cursor on N2
.
O
: Control-Down, Right, Shift-Control-Up. The cell cursor will be on cell O2
now, and the range below and including it is marked.O2
into each cell in the range.Now you will have a new column O
with the text of N
, but exchanged characters. The values are still "text", though.
If you like, you can shrink the width of column N
now, or hide it.
Example: Input wanted: DD/MM/YYYY (31/12/2021)
Input accepted: MM/DD/YYYY (12/31/2021)
First add new Date type
Second format style