| View previous topic :: View next topic |
| Author |
Message |
roronoaZoro Newbie

Joined: 06 Jun 2012 Posts: 1
|
Posted: Wed Jun 06, 2012 9:12 am Post subject: Comments to separate column |
|
|
I have one column that has many cells with comments in them. I want to create a separate column, and have all the comments move to that new column.
For example:
What I have:
Column 1
a (comment: small)
b (comment: big)
c (comment: medium)
What I need:
Col.1, Col. 2
a, small
b, big
c, medium |
|
| Back to top |
|
 |
jrkrideau Super User

Joined: 08 Aug 2005 Posts: 6733 Location: Kingston ON Canada
|
Posted: Wed Jun 06, 2012 9:53 am Post subject: Re: Comments to separate column |
|
|
| roronoaZoro wrote: | I have one column that has many cells with comments in them. I want to create a separate column, and have all the comments move to that new column.
For example:
What I have:
Column 1
a (comment: small)
b (comment: big)
c (comment: medium)
What I need:
Col.1, Col. 2
a, small
b, big
c, medium |
I think we would have to see the exact data. If a, b c are the same length then some combination of LEFT or RIGHT() might do the trick
If each comment is in a () then doing something like exporting to csv format, addng a , to each line before the ( and reading the file back into Calc might be a good approach. _________________ jrkrideau
Kingston ON Canada
Currently using Windows 7 & OOo 3.4.0 and Ubuntu 12.04 & LibreOffice 3.5.2.2 |
|
| Back to top |
|
 |
DiGro Super User


Joined: 02 Jun 2004 Posts: 1208 Location: Hoorn NH, The Netherlands
|
Posted: Wed Jun 06, 2012 10:18 am Post subject: |
|
|
You might want to use Text to columns in the menu Data when you have selected your column A
There you could give the ( as the delimiter or set a fixed width if thats better usable _________________ DiGro
Windows 7 Home Premium and OOo 3.3 NL (Dutch) |
|
| Back to top |
|
 |
karolus OOo Advocate

Joined: 22 Jun 2011 Posts: 208
|
Posted: Wed Jun 06, 2012 11:51 pm Post subject: |
|
|
Hallo
To return the Comment out of acell, use function:
| Code: | function getAnno( sheet as integer , col as integer , row as integer ) as string
osheet = thisComponent.sheets().getByIndex( sheet -1 )
getAnno = osheet.getcellByPosition( col-1, row-1).getAnnotation().getString()
end function |
Store it in a module below Standard-library, and call it from Calc for Example with:
| Code: | | =GETANNO( SHEET(A1) ; COLUMN(A1) ; ROW(A1) ) |
Karo |
|
| Back to top |
|
 |
|