Automatic Coloring of Odd and Even Rows

From NeoWiki

(Difference between revisions)
Jump to: navigation, search
Revision as of 15:47, 30 January 2008 (edit)
Jgd (Talk | contribs)
(add fixme (English is not yet polished))
← Previous diff
Revision as of 17:38, 30 January 2008 (edit) (undo)
Lorinda (Talk | contribs)
(A little polish; remove fixme)
Next diff →
Line 1: Line 1:
-{{Fixme}}+You can format a spreadsheet to alternate the background color in the rows of a cell range. To do that, you need to create a style for each color and then use ''conditional formatting''.
-You can format a spreadsheet to alternate the row background color of a cell range. To do that, you need to create a style for each color, then to use the ''conditional formating''.+
==Creating the Style== ==Creating the Style==
Line 8: Line 7:
*In the {{window|Format Cells}} window that appears, click on the {{prefName|Background}} tab. *In the {{window|Format Cells}} window that appears, click on the {{prefName|Background}} tab.
*Choose the color you desire and click {{button|OK}}. *Choose the color you desire and click {{button|OK}}.
-*This cell being still selected, go to the {{menu|Format}} menu and select {{menu|Styles and Formatting}}.+*While this cell is still selected, go to the {{menu|Format}} menu and select {{menu|Styles and Formatting}}.
*In the {{window|Styles and Formatting}} window, click on the {{button|New Style from Selection}} icon (the second icon from the right). *In the {{window|Styles and Formatting}} window, click on the {{button|New Style from Selection}} icon (the second icon from the right).
*In the dialog that opens, give this style a name, for example '''OddRow'''. *In the dialog that opens, give this style a name, for example '''OddRow'''.
Line 14: Line 13:
==Conditional Formatting== ==Conditional Formatting==
-*Select the whole page by pressing the {{key|Command-A}} keys, or only the range you want to be formatted this way.+*Select the whole page by pressing the {{key|Command-A}} keys, or select only the range you want to be formatted this way.
*Go to the {{menu|Format}} menu and select {{menu|Conditional Formatting…}}. *Go to the {{menu|Format}} menu and select {{menu|Conditional Formatting…}}.
*In the {{window|Conditional Formatting}} window, in the {{section|Condition 1}} section, choose {{prefName|Formula is}} in the drop-down menu and enter *In the {{window|Conditional Formatting}} window, in the {{section|Condition 1}} section, choose {{prefName|Formula is}} in the drop-down menu and enter

Revision as of 17:38, 30 January 2008

You can format a spreadsheet to alternate the background color in the rows of a cell range. To do that, you need to create a style for each color and then use conditional formatting.

Creating the Style

  • Open a new spreadsheet.
  • Select a cell.
  • Go to the Format menu and select Cells….
  • In the Format Cells window that appears, click on the Background tab.
  • Choose the color you desire and click OK.
  • While this cell is still selected, go to the Format menu and select Styles and Formatting.
  • In the Styles and Formatting window, click on the New Style from Selection icon (the second icon from the right).
  • In the dialog that opens, give this style a name, for example OddRow.
  • Repeat these steps with a second cell and call the style EvenRow.

Conditional Formatting

  • Select the whole page by pressing the Command-A keys, or select only the range you want to be formatted this way.
  • Go to the Format menu and select Conditional Formatting….
  • In the Conditional Formatting window, in the Condition 1 section, choose Formula is in the drop-down menu and enter
ISODD(ROW())
in the text box.
  • Enter OddRow in the drop-down menu of the Cell Style section.
  • Check the Condition 2 box.
  • Choose Formula is in the drop-down menu and enter
ISEVEN(ROW())
in the text box.
  • Enter EvenRow in the drop-down menu of the Cell Style section.
  • Click OK.
This will apply automatically if you insert or delete rows in the cell range.



Three Different Colors

The conditional formatting allows you to set three conditions. Thus you can apply this method to three rows. Let us suppose that you have created three styles called Row1, Row2 and Row3.

  • Select the whole page by pressing the Command-A keys, or only the range you want to be formatted this way.
  • Go to the Format menu and select Conditional Formatting….
  • In the Conditional Formatting window, in the Condition 1 section, choose Formula is in the drop-down menu and enter the formula
MOD(ROW();3)=1
  • Enter Row1 in the drop-down menu of the Cell Style section.
  • Check the Condition 2 box.
  • Choose Formula is in the drop-down menu and enter the formula
MOD(ROW();3)=2
  • Enter Row2 in the drop-down menu of the Cell Style section.
  • Check the Condition 3 box.
  • Choose Formula is in the drop-down menu and enter the formula
MOD(ROW();3)=0
  • Enter Row3 in the drop-down menu of the Cell Style section.
  • Click OK.


This article in other languages: Français
Personal tools