OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

[Solved] adding to numbers with a char inbetween the numbers

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Calc
View previous topic :: View next topic  
Author Message
aloarjr810
OOo Enthusiast
OOo Enthusiast


Joined: 04 Jun 2008
Posts: 113

PostPosted: Mon Jun 07, 2010 9:41 am    Post subject: [Solved] adding to numbers with a char inbetween the numbers Reply with quote

Hope I phrased that right.

what I'm looking for is to be able to put in cell A1 this 1&2 or 13&14 etc.
then in cell B2 and the following cells have it say 3&4,5&6 etc. or 15&16,17&18 etc

I remembered this post "How to sum cells that have a letter in the cells?" but couldn't quite adapt it to work.

I came up with this formula, which I think is close but I'm not getting the whole number.
Code:
=(LEFT(A2;1)+2)&"&"&RIGHT(A2;1)+2



I've tried leading zeros 01&02 and varying the other parameters, but don't quite get the right result.


Last edited by aloarjr810 on Mon Jun 07, 2010 10:49 am; edited 1 time in total
Back to top
View user's profile Send private message
Robert Tucker
Moderator
Moderator


Joined: 16 Aug 2004
Posts: 3407
Location: Manchester UK

PostPosted: Mon Jun 07, 2010 10:27 am    Post subject: Reply with quote

=(LEFT(A2;(FIND("&";A2)-1))+2&"&")

seems to get the number before the ampersand.
_________________
OpenOffice 4.0.0 and LibreOffice 4.x.x on Fedora 20, Ubuntu 13.10, Windows 8.1 Preview (Triple Boot)
Back to top
View user's profile Send private message
Robert Tucker
Moderator
Moderator


Joined: 16 Aug 2004
Posts: 3407
Location: Manchester UK

PostPosted: Mon Jun 07, 2010 10:41 am    Post subject: Reply with quote

Try:

=LEFT(A2;(FIND("&";A2)-1))+2&"&"&RIGHT(A2;LEN(A2)-FIND("&";A2))+2

for the whole lot.
_________________
OpenOffice 4.0.0 and LibreOffice 4.x.x on Fedora 20, Ubuntu 13.10, Windows 8.1 Preview (Triple Boot)
Back to top
View user's profile Send private message
aloarjr810
OOo Enthusiast
OOo Enthusiast


Joined: 04 Jun 2008
Posts: 113

PostPosted: Mon Jun 07, 2010 10:49 am    Post subject: Reply with quote

Robert Tucker wrote:
Try:

=LEFT(A2;(FIND("&";A2)-1))+2&"&"&RIGHT(A2;LEN(A2)-FIND("&";A2))+2

for the whole lot.


Thanks RT! that seems to work ok.
Back to top
View user's profile Send private message
JohnV
Administrator
Administrator


Joined: 07 Mar 2003
Posts: 9183
Location: Lexinton, Kentucky, USA

PostPosted: Mon Jun 07, 2010 10:50 am    Post subject: Reply with quote

Very nice Robert. I went at it with a user defined function.
Code:
Global l,r
Function AdvanceNumbers
If l = 0 then
  l = 1
 Else l = l + 2
EndIf
r = r + 2
AdvanceNumbers = l &"&"& r 
End Function
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Calc All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2005 phpBB Group