Page 1 of 1

[Solved] Conditional format strangeness

Posted: Wed May 01, 2019 1:59 pm
by arathra
I'm having a strange result in my conditional formatting.
I selected a COLUMN where the conditional formatting is needed.
I clicked on FORMAT > CONDITIONAL FORMATTING and in the dialog box put in > If the cell = 'JOE' then use style GREENBACKGROUND.
But then when I click OK, the entire column turns to green EXCEPT for ANY cell which is NOT empty.
Strange and not what I expected. Obviously I'm doing something the wrong way around - can anyone help?
Thanks!

Re: conditional format strangeness

Posted: Wed May 01, 2019 2:31 pm
by Zizi64
Please upload a real, ODF type sample file here.

Re: conditional format strangeness

Posted: Wed May 01, 2019 3:02 pm
by RoryOF

Re: conditional format strangeness

Posted: Wed May 01, 2019 3:21 pm
by gerard24
Just put double quotes around text : "Joe"

Re: conditional format strangeness

Posted: Thu May 02, 2019 9:06 am
by arathra
gerard24 wrote:Just put double quotes around text : "Joe"
Perfect... and so simple when you know how! Thanks! :)

Re: conditional format strangeness

Posted: Thu May 02, 2019 9:21 am
by keme
gerard24 wrote:Just put double quotes around text : "Joe"
Here is why it works:
  • When you test for equality to 'Joe' (or equality to Joe, i.e. unquoted), Calc takes it as a "data name" (cell, range, variable, etc.). Single quotes is only required when your data name contains spaces, but will always "dereference" the quoted content. If a name is undefined, the value returned is numerical zero. Numeric return from an empty cell is also zero. Hence, 'Joe' equals empty cells and the style is applied.
  • When you test for equality to "Joe" (using double quotes), calc will take it as actual data and compare character by character. "Joe" does not equal an empty cell.
Strangeness eliminated, hopefully.

Re: Conditional format strangeness

Posted: Thu May 02, 2019 1:57 pm
by arathra
Strangeness eliminated indeed! Thanks!