Click to See Complete Forum and Search --> : Nested IF on OpenOffice Calc


MkIII_Supra
11-05-2008, 03:15 PM
=IF(C2="+"; RIGHT(B2,2); IF(C2="-"; RIGHT(B2,2); RIGHT(C2,1)))

That's the nested if. Simple really, IF a cell = + then I want the right 2 elements of another cell, if that same cell = - then I want the right 2 elements of another cell otherwise just give me the last element of the cell.

I have looked all over and from what I have found I have the syntax correct but I am still getting an Err:508

MkIII_Supra
11-06-2008, 01:56 PM
Anyone?

LAT
11-06-2008, 06:20 PM
I'm not sure I completely understand what you want your result to be, but if I'm reading your formula correctly, this is what worked for me.

=IF(OR(C2="+";C2="-");RIGHT(B2;2);RIGHT(C2;1))

MkIII_Supra
11-06-2008, 07:38 PM
I have OpenOffice 3.0
Open SuSE 11.0
KDE 3.5

In column B there are entries like below:

s3nD+
s2nC
s1nA
s1nA+
s1nA
s1nB-
s1nA
s1nA
s1nA+
s1nA
s1nA
s1nB
s1nA-
s1nA

I want the to extract the right most character if there is no + or -.

If there is a + or - then I want to extract the 2 right most characters.

I can get it to work with one but not two. Never mind, I found another solution. Thanks though!

LAT
11-06-2008, 09:59 PM
Ah, I think I see what you wanted now. I know you've already found your solution but I'll post my formula anyway.

=IF(OR(RIGHT(B2;1)="+";RIGHT(B2;1)="-");RIGHT(B2;2);RIGHT(B2;1))

I have OO 2.4 on Debian Lenny.

bwkaz
11-07-2008, 12:29 AM
I've never used OO macros at all, so this syntax may be horrifically wrong. But another solution seems to present itself:

=RIGHT(B2, LENGTH(B2)-3)

Should work whether a + is present, a - is present, or neither is present -- at least for the input list you gave. ;)

LAT
11-08-2008, 01:39 AM
I bow to the master ;)
I knew all those RIGHTs bothered me! Syntax is a little off but a lesson well learned.

=RIGHT(B2;LEN(B2)-3)

thanks bwkaz!