Skip to content

Instantly share code, notes, and snippets.

@dhruva81
Created February 4, 2019 03:54
Show Gist options
  • Select an option

  • Save dhruva81/c1259b96e267e0142ca15c439da40d60 to your computer and use it in GitHub Desktop.

Select an option

Save dhruva81/c1259b96e267e0142ca15c439da40d60 to your computer and use it in GitHub Desktop.
By default, Excel provides the Conditional Formatting feature for us to complete this problem, please do as follows:
1. Select the data range that you want to highlight every nth row.
2. Click Home > Conditional Formatting > New Rule, see screenshot:
3. In the New Formatting Rule dialog box, click Use a formula to determine which cells to format option from the Select a Rule Type: list box, and then type this formula =MOD(ROW(),8)=0 into the Format value where this formula is true text box,
Tips: with above formula, you can highlight every fourth row in the range, you can change the number 4 to 3, 5, 6…for your need.
4. After entering the formula, then please click Format button to go to the Format Cells dialog, choose one color you like under the Fill tab.
If you want to highlight every nth column, please apply this formula: =MOD(COLUMN(), n)=0.
If you want to highlight every nth row, please apply this formula: =MOD(ROW(), n)=0.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment