Syntax of Formula to change cell color

Discuss the spreadsheet application
Post Reply
User avatar
Ironmanxp
Posts: 15
Joined: Fri May 27, 2016 4:28 am

Syntax of Formula to change cell color

Post by Ironmanxp »

Hi,

Would like to understand how to write a formula that would conditionally change the format in a selected cell such as cell color and or font size/style, etc. Example syntax sample would be helpful. :?:

Thanks
Apache OpenOffice 4.1.2 on Windows 10
User avatar
robleyd
Moderator
Posts: 5078
Joined: Mon Aug 19, 2013 3:47 am
Location: Murbko, Australia

Re: Syntax of Formula to change cell color

Post by robleyd »

You may want conditional formatting rather than a formula; open help - F1 - and search conditional formatting for more information.

If this doesn't meet your needs, perhaps you could give a bit more detail of what it is you want to achieve.
Cheers
David
OS - Slackware 15 64 bit
Apache OpenOffice 4.1.15
LibreOffice 24.2.2.2; SlackBuild for 24.2.2 by Eric Hameleers
User avatar
Zizi64
Volunteer
Posts: 11358
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: Syntax of Formula to change cell color

Post by Zizi64 »

or:
You can use the Style() function in your formula. The function will aplly an existing cell style - You can use the function once in a formula, or (combined with the IF() ) conditionally.

For the numeric results. The "return value" of the function Style equals 0):

Code: Select all

= A1  + Style("MyCellStyle")

For the string results.:

Code: Select all

= A1  & T(Style("MyCellStyle"))
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
User avatar
Ironmanxp
Posts: 15
Joined: Fri May 27, 2016 4:28 am

Re: Syntax of Formula to change cell color

Post by Ironmanxp »

Thanks, i'll check those out.
Apache OpenOffice 4.1.2 on Windows 10
Post Reply