We can even sort the rows without affecting the formatting. To apply this method, select the first cell we want to format (cell A1 in this example) and follow these steps.
1. Choose Conditional Formatting from the Format menu to display the Conditional Formatting dialog box (top).
2. Select Formula Is from the pop-up menu, and enter the formula =MOD(ROW(A1),2)=1 in the box to the right of the pop-up menu.
3. Click the Format button, and in the dialog box that appears, click the Patterns tab, pick a color, and click OK.