[Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register]

Author Message
Cham
Newbie

Joined: 01 Aug 2008
Posts: 3

Posted: Fri Aug 01, 2008 6:30 pm    Post subject: Need help with data manipulation in NeoOffice

I need help with some data manipulation in NeoOffice. I am not an expert with spreadsheet apps I have a LARGE bunch of mixed numbers (three cartesian coordinates) and text, like this very small sample :

 Code: vertices \$ 0.587341   -0.004852   0.809325 0.587344   0.003316   0.809330 0.589727   0.017470   0.807414 0.593521   0.029771   0.804268 linestrip \$ vertices \$ 0.489287   -0.011868   0.872042 0.480151   -0.042015   0.876179 0.477583   -0.056780   0.876750 0.481149   -0.062965   0.874375 0.503490   -0.080895   0.860206 0.505628   -0.091953   0.857838 0.506437   -0.106646   0.855657 linestrip \$

I need to replace each \$ with the number of points (an integer) enclosed within the words "vertices" and "linestrip". In this example, I want to get this :

 Code: vertices 4 0.587341   -0.004852   0.809325 0.587344   0.003316   0.809330 0.589727   0.017470   0.807414 0.593521   0.029771   0.804268 linestrip 4 vertices 7 0.489287   -0.011868   0.872042 0.480151   -0.042015   0.876179 0.477583   -0.056780   0.876750 0.481149   -0.062965   0.874375 0.503490   -0.080895   0.860206 0.505628   -0.091953   0.857838 0.506437   -0.106646   0.855657 linestrip 7

Next, I need to replace each empty line below the "linestrip" with integers from 0, 1, 2, ... to \$-1, like this :

vertices 4
 Code: 0.587341   -0.004852   0.809325 0.587344   0.003316   0.809330 0.589727   0.017470   0.807414 0.593521   0.029771   0.804268 linestrip 4 0 1 2 3 vertices 7 0.489287   -0.011868   0.872042 0.480151   -0.042015   0.876179 0.477583   -0.056780   0.876750 0.481149   -0.062965   0.874375 0.503490   -0.080895   0.860206 0.505628   -0.091953   0.857838 0.506437   -0.106646   0.855657 linestrip 7 0 1 2 3 4 5 6

Someone knows how to do this, in OpenOffice (I'm using the OS X version) ?
RickRandom
Super User

Joined: 27 Jan 2006
Posts: 1082
Location: UK

 Posted: Sat Aug 02, 2008 12:01 am    Post subject: It's a bit clumsy, but: With the first word "vertices" in cell A2, and the data in columns A, B and C: Put in D2: =if(A2="vertices";0;if(A2="linestrip";D1;if(and(A1="linestrip";isblank(A2));0;D1+1))) and copy down as far as necessary. Put in E2: =if(A2="vertices";vlookup("linestrip";A3:\$D\$21;4;TRUE);if(A2="linestrip";D1;if(isnumber(B2);B2;D2))) and copy down as far as necessary. (Adjust the \$D\$21 to cover the size of your data.) This gives you a new column to use instead of column B. Let us know if this works, but I think this would be better done in a programming language (not that I could do it. )
Cham
Newbie

Joined: 01 Aug 2008
Posts: 3

 Posted: Sat Aug 02, 2008 5:34 am    Post subject: Thanks a lot for your reply ! The first instruction (in D2) is working, apparently. At least, it's giving me a column of integers... But when I insert the other instruction in cell E2, I'm getting a #NAME? and I'm unable to get it to work (this is one thing I never understood clearly in OpenOffice). Also, should I remove all the \$ in my data ?
 Display posts from previous: All Posts1 Day7 Days2 Weeks1 Month3 Months6 Months1 Year Oldest FirstNewest First
 All times are GMT - 8 Hours Page 1 of 1

 Jump to: Select a forum OpenOffice.org Forums----------------Setup and TroubleshootingOpenOffice.org WriterOpenOffice.org CalcOpenOffice.org ImpressOpenOffice.org DrawOpenOffice.org MathOpenOffice.org BaseOpenOffice.org Macros and APIOpenOffice.org Code Snippets Community Forums----------------General DiscussionSite Feedback
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum