# Set the number of rows dynamically in a Conga Excel template

When using =ROW() you must subtract the number of rows above the formula.

If, for example, your formula goes in cell A5:

If you put "=ROW()" in that cell, the result is "5". So by subtracting 4 (the number of rows above it), the result gives you a 1. Thus, the formula is =ROW()-1 at this point.

Finally, to get it to repeat for each detail row of merge data, let's make it a dynamic repeating formula:

&=&=ROW()-4

That should do the trick! Just adjust the "4" accordingly.