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

IF function

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Calc
View previous topic :: View next topic  
Author Message
Alwyn@SparepennyLa
General User
General User


Joined: 08 May 2010
Posts: 20

PostPosted: Thu Jun 28, 2012 3:15 am    Post subject: IF function Reply with quote

Is it possible to specify a logical function dependent on colour (Brit. Eng)?

Example:

If the specified cell has red text because it's formatted to be red for a negative figure I want the text in the current cell to be red instead of black.
Back to top
View user's profile Send private message AIM Address
karolus
OOo Advocate
OOo Advocate


Joined: 22 Jun 2011
Posts: 210

PostPosted: Thu Jun 28, 2012 4:46 am    Post subject: Reply with quote

Hallo
→Format→Conditional Formating still exists !

Karo
Back to top
View user's profile Send private message
Alwyn@SparepennyLa
General User
General User


Joined: 08 May 2010
Posts: 20

PostPosted: Thu Jun 28, 2012 7:01 am    Post subject: Reply with quote

Thanks Karo but I'm not sure how to make a condition dependent on another cell. I already have conditional formatting in the adjacent cell that shows figures in red in brackets if the figure is negative.

Currently, if the adjacent cell is empty then nothing shows; if there is an entry (figures) then £ (Sterling) appears. What I want to do is make the £ sign red if the figures in the adjacent cell are negative.
Back to top
View user's profile Send private message AIM Address
keme
Moderator
Moderator


Joined: 30 Aug 2004
Posts: 2910
Location: Egersund, Norway

PostPosted: Fri Jun 29, 2012 12:47 am    Post subject: Reply with quote

You can't easily extract applied colour for use in formulas, but if that colour is based on a condition you can use the original dependency again.

If this is needed only for display purposes (i.e. you don't need to extract that £ sign from the cell), you can repeat the value and use formatting to display the £ sign. It's a bit "quick and dirty" solution, but should work also if exported to other spreadsheet formats.

Explicitly, assuming that your amount is in cell D2 and you need the £ sign in C2:
Formula in C2: =D2
Format string for C2: "£";[RED]"£";"";""

The above will not distinguish zero and empty cells, so if you have entries with a "zero amount" it will not display the pound sign. A bit more elaborate construct to handle that:
Formula in C2: =IF(ISNUMBER(D2);D2;"")
Format string for C2: "£";[RED]"£"
Back to top
View user's profile Send private message
Alwyn@SparepennyLa
General User
General User


Joined: 08 May 2010
Posts: 20

PostPosted: Fri Jun 29, 2012 3:50 am    Post subject: Logical function dependant on colour Reply with quote

Many thanks keme, most helpful.

I guess in that case that it would also be possible to take this further and include underlining and bold if it's in the next cell. I think that's probably an unnecessary refinement though.
Back to top
View user's profile Send private message AIM Address
keme
Moderator
Moderator


Joined: 30 Aug 2004
Posts: 2910
Location: Egersund, Norway

PostPosted: Tue Jul 10, 2012 2:30 am    Post subject: Re: Logical function dependant on colour Reply with quote

Alwyn@SparepennyLa wrote:
Many thanks keme, most helpful.

I guess in that case that it would also be possible to take this further and include underlining and bold if it's in the next cell.

Not directly, no.

My suggestion does not use the format of the source cell, but "recycles" the condition causing that format. Specifically, instead of asking "is C2 printed in red?" we ask "is C2 holding a negative number?", then assign the red colour based on that.
Like I said, you can't easily extract cell colour, and that also goes for other formatting elements (like bolding and underlining).

I have seen mentions of extensions that enable such extraction, but I haven't used them so I do not know how they will affect portability and robustness for your spreadsheet (i.e. how they behave when opened in a different computer, or when you upgrade your own software).
Back to top
View user's profile Send private message
Alwyn@SparepennyLa
General User
General User


Joined: 08 May 2010
Posts: 20

PostPosted: Tue Jul 10, 2012 8:05 am    Post subject: Re: Logical function dependant on colour Reply with quote

keme wrote:
Alwyn@SparepennyLa wrote:
Many thanks keme, most helpful.

I guess in that case that it would also be possible to take this further and include underlining and bold if it's in the next cell.

Not directly, no.

My suggestion does not use the format of the source cell, but "recycles" the condition causing that format. Specifically, instead of asking "is C2 printed in red?" we ask "is C2 holding a negative number?", then assign the red colour based on that.
Like I said, you can't easily extract cell colour, and that also goes for other formatting elements (like bolding and underlining).

I have seen mentions of extensions that enable such extraction, but I haven't used them so I do not know how they will affect portability and robustness for your spreadsheet (i.e. how they behave when opened in a different computer, or when you upgrade your own software).


Many thanks for this. It explains the process. As far as portability is concerned it's bad enough saving an ods document as an xls document or an odt doc as a doc document either of which seem to give rise to formatting problems for MS Office users. For that reason we tend to send them out as pdfs.
Back to top
View user's profile Send private message AIM Address
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