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

Author Message
Alwyn@SparepennyLa
General User

Joined: 08 May 2010
Posts: 20

 Posted: Thu Jun 28, 2012 3:15 am    Post subject: IF function 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.
karolus

Joined: 22 Jun 2011
Posts: 210

 Posted: Thu Jun 28, 2012 4:46 am    Post subject: Hallo →Format→Conditional Formating still exists ! Karo
Alwyn@SparepennyLa
General User

Joined: 08 May 2010
Posts: 20

 Posted: Thu Jun 28, 2012 7:01 am    Post subject: 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.
keme
Moderator

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

 Posted: Fri Jun 29, 2012 12:47 am    Post subject: 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]"£"
Alwyn@SparepennyLa
General User

Joined: 08 May 2010
Posts: 20

 Posted: Fri Jun 29, 2012 3:50 am    Post subject: Logical function dependant on colour 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.
keme
Moderator

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

Posted: Tue Jul 10, 2012 2:30 am    Post subject: Re: Logical function dependant on colour

 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).
Alwyn@SparepennyLa
General User

Joined: 08 May 2010
Posts: 20

Posted: Tue Jul 10, 2012 8:05 am    Post subject: Re: Logical function dependant on colour

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.
 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