Sometimes you discover a feature that makes using a particular tool incredibly efficient. Conditional formatting is that feature in LibreOffice's spreadsheet application Calc.
What is conditional formatting?
Let's say you are about to create a huge spreadsheet, and certain cells must be formatted in a specific way based on other cells. For example, any cell with a number under a specific value must be formatted with a green background and over a specific value is formatted with a red background. Instead of going back and formatting each cell, conditional formatting will do this automatically.
In this tutorial, I walk through how to create this kind of formatting. We'll stick with my example:
- Value < 100 = Green
- Value > 100 = Red
The first step is to create the styles you want to use for the conditional formatting by following these steps in Calc:
- Open the Styles And Formatting window from within Calc by going to Format | Styles And Formatting.
- Make sure you're on Cell Formatting (upper left corner) and then right-click any blank area in the window and select New.
- In the resulting window, give the style an appropriate name in the Organizer tab (Figure A).
- Go to the Background tab and create the style appropriate for the value.
- Click OK.
For our example, you would need to create two styles:
- One with a green background for the value under 100.
- One with a red background for the value over 100.
In the Conditional Formatting window, follow these steps:
- In the first row of drop-downs, select Cell Value Is and Less Than.
- In the text area, enter 100.
- In the Cell Style drop-down, select the new style you created for the green value (in my case, I called it GreenValue).
- Go to the second condition and create the second condition for the red value (greater than 100).
- Click OK.
One number that wasn't addressed in the conditions is 100.
Conditional formatting doesn't just work with cell values; you can also use formulas for conditions, and you can mix and match. For example, you could have a condition that does the following:
If a formula is A * B and the result is equal to or greater than 100, the background is red and the font is bold. Set a second condition that if a formula is B * C and the result is equal to or greater than 100 the background is green and the font is italics.
You can get pretty creative with conditional formatting. Even though you are limited to only three conditions, you can do quite a lot to help get your spreadsheets formatted correctly and efficiently. You no longer have to go back, highlight cells, and manually format cells according to numerical number.
Also read: DIY: Add drop-down lists to LibreOffice spreadsheetsFull Bio
Jack Wallen is an award-winning writer for Techrepublic and Linux.com. As an avid promoter/user of the Linux OS, Jack tries to convert as many users to open source as possible. His current favorite flavor of Linux is Bodhi Linux (a melding of Ubuntu and Enlightenment). When Jack isn't writing about Linux he is hard at work on his other writing career -- writing about zombies, various killers, super heroes, and just about everything else he can manipulate between the folds of reality. You can find Jack's books on Amazon, Barnes & Noble, and Smashwords. Outnumbered in his house one male to two females and three humans to six felines, Jack maintains his sanity by riding his mountain bike and working on his next books. For more news about Jack Wallen, visit his website Get Jack'd.



