On 12/17/09 23:55, Brian Barker wrote:
At 14:07 17/12/2009 -0500, James Lockie wrote:
I have a list of text that I want to convert to a 3 column table.
I have paragraphs like:
1
2
3
4
5
6
7
8
9
I want a table like this:
1 2 3
4 5 6
7 8 9
Is this a text (Writer) document? Or a Calc spreadsheet?
If this is a text document and if your list is not particularly long,
one way would be to combine each set of three paragraphs, replacing
the internal paragraph breaks with tabs or some suitable character
(that doesn't otherwise appear). So you have, say,
1#2#3
4#5#6
7#8#9
Then select the entire material and use Table | Convert > | Text to
Table... , inserting your sentinel character at "Other:".
Alternatively, open a new spreadsheet and copy the material from your
text document into A1 - so that it appears, one paragraph to a cell,
in column A. For convenience, select columns A to D and tick the
option at Format | Cells... | Alignment | Properties | Wrap text
automatically. In B1, enter: =INDIRECT("A"&3*ROW()+COLUMN()-4) .
Fill or copy this across the three columns B to D and down the columns
as far as necessary. Select the reformatted material (B1 to
D-whatever) and copy it. Return to your text document and use Edit |
Paste Special... (or Ctrl+Shift+V), selecting "Formatted text [RTF]"
from the available options. Reformat the table as necessary.
How does this work? The ROW() and COLUMN() functions return the row
and column numbers of the cells in which the formulae appear - the
destination cells, that is. (In this context, column 1 is column A
and so on.) The formula 3*row+column-4 returns the row number of the
source cell to be copied to that destination cell. This is
concatenated (using "&") with the column label "A" to create the full
reference to the source cell. That may seem like the answer, but so
far you would only see a text string in each destination cell, so that
B1 would contain "A1", C1 would contain "A2", and so on. The
INDIRECT() function converts these text strings into actual cell
references.
I trust this helps.
Brian Barker
Thanks.
Maybe able | Convert > | Text to Table... should let me specify the the
number of columns I want. :-)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]