Using MOD and ROW to format hyperblocks
This topic describes how to use the MOD and ROW functions to assign different formats to alternate lines of a hyperblock-based report. It refers to sample report RP007.
Report RP007 has two, overlapping hyperblocks, created from the Region and Period dimensions of the Analysis cube. The Region hyperblock is formatted to display the darker grey background, with a white bottom border. A conditional format in the hyperblock uses the MOD and ROW spreadsheet functions to apply the lighter grey background to alternate cells.
The ROW function returns the number of a row specified by a cell
reference. Its syntax is
=ROW()
.
The MOD function divides one number by another and returns the
remainder. Its syntax is=MOD(number, divisor)
If you add =n to the MOD function, it returns TRUE or FALSE. For
example, the formula
=MOD(15,2)=1
returns TRUE. But
=MOD(14,2)
returns FALSE. That is, 15 divided by 2
leaves a remainder of 1. But 14 divided by 2 leaves no remainder.
The conditional format uses the ROW function to return the row number, and the MOD function to return the result of dividing that row number by 2. For each alternate row, the remainder of that division is 0 or 1.
The formula for the conditional format is
MOD(ROW(),2)=1
. That is, the ROW function is used as
the number argument of the MOD function. If the result of dividing the row
number by two is a remainder of 1, the conditional format is applied.
To create a hyperblock-based report with alternating row colors: