2009/11/9 Harold Fuchs <hwfa.openoff...@googlemail.com>: > 2009/11/9 Walter Hildebrandt <wh2...@gmail.com> > >> What does 0 mean and what is its effect in various condition? >> > > In a numeric context, 0 means zero. > If you try to treat *text* in a numeric context then the text will usually > be treated as zero. > > >> For example : When I got the formula =A1-40+IF(A1>40;STYLE("RedText");0), >> I >> was told “The STYLE function always returns 0, so the formula is >> mathematically >> equal to A1-40+0” > > > Correct. I don't know where you got that formula but it doesn't do anything > useful. See below.
Depends on what is useful… It calculates A1-40 and if A1>40 the the cell will use the style ”RedText”. If not, it will use the current style. In both cases, the return value is 0, so the result won't change. As I probably already said whan I very quickly made this formula, there are other ways to do this, but since all methods that I knew of already were suggested, I suggested this one as a start, ready for development. > > >> What is effect of the 0 at the end of the formula? >> > > The syntax of an IF consists of three components: > > 1. the condition > 2. what to do if the condition is true > 3. what to do if the condition is false > > These are separated by semicolons. Thus your IF, which is > IF(A1>40;STYLE("RedText");0) > says > if the contents of cell A1 is greater than 40 [#1, the condition] > set the current cell's value to STYLE("RedText") [#2, what to do if > the condition is true] > otherwise set the current cell's value to zero [#3, what to do if the > condition is false] > > However, all this is nonsense. Calc's Help on the Style function tells us > that its syntax is nothing like the one you cited and that it doesn't do > anything like what you've been told. I quote: Still, it works. Of course I tested it before sent my message. > > ======== begin quote ==== > Syntax > > STYLE(style;time;style2) > > Style is the name of a cell style assigned to the cell. Style names must be > entered in quotation marks. > > Time is an optional time range in seconds. If this parameter is missing the > style will not be changed after a certain amount of time has passed. > > Style2 is the optional name of a cell style assigned to the cell after a > certain amount of time has passed. If this parameter is missing "Standard" > is assumed. > > ===end quote === > > > >> For example if “Negative numbers red” is selected (is checked) when >> formatting cells, 0:[RED]-0 appears in the Format code box. >> >> For example I was told “Enter something like this in the format code >> field: >> 0"%" This will just add the % character right after the number, but the >> number will still act as an ordinary number.” >> > > "Something like" is probably true depending on your definition of the > phrase. A dog is something like a horse, perhaps: 4 legs, tail, hair, friend > of mankind. But ... > > >> Also when entering the O, under different conditions, Is the 0 a zero or a >> capital letter? >> > > usually zero. A bare (unquoted) letter O would normally only be meaningful > if you had *named* something (like a print-range) "O". > > Why don't you use the Conditional Formatting menu to do what you want? > > > -- > Harold Fuchs > London, England > Please reply *only* to users@openoffice.org > Johnny Rosenberg --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@openoffice.org For additional commands, e-mail: users-h...@openoffice.org