Copying cell contents to create phrase

In short I am having to "massage" a .csv file exported from one system before importing it into an accounting system.

The accountant wants a "Comment" column added before importing the file which summarises information held in four other columns. Two columns contain names and do not present a problem but the other two have dates. In the .csv file the dates are shown 02-Oct-14 and I am having trouble getting these dates treated as text.

To get the names I have:-
=B2&" "&C2 but how do I copy the dates?

Does anybody have time to help me here please.
Budgie

If you have real dates in the columns and you need to include them as text in the additional column, just use TEXT(D2;"DD-MMM-YY") where you would otherwise use D2 in your formula, and so on.

But if you mean that your original CSV file has these dates in this format, there is an easier way. When you open the CSV file, you should see the Text Import dialogue. Under Fields, click in the date columns and then select Text from the drop-down menu against "Column type". The dates will be imported as text and you will not need the above workaround.

I trust this helps.

Brian Barker

Hi Brian,
Many thanks. Got it and it is working.
I do still have some issues. If I work on the .csv file in Calc and add columns etc, save as a .csv and re open in Calc the columns are changed in that I get contents of some cells are split into two columns.

I shall do some reading but guess this might be because column content is not a single entry but sometimes several in one cell, separated by space or comma. Am I correct?

Regards,
Budgie

Hi Brian,
Having managed to write the comment column with your help I have another problem. The contents of the comment cells comprise elements put there by the formula. How may I "freeze" them as text so that I may delete the columns used by the formula?

Budgie

As its name suggests, the default separator in a CSV file is indeed a comma, so commas in cell text could potentially be a problem. But experiment suggests to me that Calc will automatically enclose any text containing a comma in double quotes, in order to escape the problem. So I'm not sure what you are seeing.

When you first save as .csv you will see the "Export of text files" dialogue, in which you can choose both the field delimiter - normally a comma - and the text delimiter - normally double quotes. Does modifying either of these affect your problem? If you are working with your CSV file and need to get back to these settings, use Save As... (which lets you save back to the same CSV file) but tick the "Edit filter settings" box in the Save As dialogue.

I trust this helps.

Brian Barker

o Copy the relevant cells.
o Go to Edit | Paste Special... (or right-click | Paste Special... or Ctrl+Shift+V).
o In the Paste Special dialogue, ensure that "Paste all" is not ticked and then that Text (or whatever) is ticked but Formulas is *not* ticked.

I trust this helps.

Brian Barker

Hi Brian,
I spent an age trying to find this with no luck before asking here, so once more I am in your debt. It works. Just what I needed, so many thanks once more.
Budgie

Brian,
One last (I hope) question related to the task in hand. I have some instructions from my accountant concerning the preparation of the file before saving as .csv to import. She says:-

  "the data in the booking date column must not have the time. So highlight all the cells then right click over them and click on format cells. Click on custom under category and then scroll up the options to find dd/mm/yyyy. Then select that and click OK"

These are written for Excel. At a guess, "custom" might equate to "user defined" but if I select that no options are offered. OTOH if I select "date" I can select dd/mm/yyyy but does that eliminate any time data in the cells and achieve her purpose?

Sorry to be dumb once more.
Budgie.

One last (I hope) question related to the task in hand. I have some instructions from my accountant concerning the preparation of the file before saving as .csv to import. She says:-
"the data in the booking date column must not have the time. So highlight all the cells then right click over them and click on format cells. Click on custom under category and then scroll up the options to find dd/mm/yyyy. Then select that and click OK"

These are written for Excel. At a guess, "custom" might equate to "user defined" but if I select that no options are offered. OTOH if I select "date" I can select dd/mm/yyyy ...

The User-defined category populates as you define new formats. You don't need to select it unless you wish to reuse a format you have previously defined. You can type the code for any format you want in the "Format code" box. The Category will set itself according to whether you are entering something standard or something new. But as you say, the format you require is already there.

... but does that eliminate any time data in the cells and achieve her purpose?

Yes. At least, it suppresses any display of time data - and thus the presence of any such data in what you save to CSV.

Brian Barker

Hi,

"the data in the booking date column must not have the time. So
highlight all the cells then right click over them and click on format
cells. Click on custom under category and then scroll up the options to
find dd/mm/yyyy. Then select that and click OK"

Those are formatting instructions for the cell, but that won't remove
timestamp data if it is present in the cell value, it will simply hide it.

Alex