Row number in calc function

I’m trying to make a function in calc that prints the row number of a cell. I tried creating the sequence:

=IF(U4="",4,"")

=IF(U4="",5,"")

=IF(U4="",6,"")

=IF(U4="",7,"")

and then dragging the formula downwards, but it just cycles 4 5 6 7 4 5 6 7.

I fail to understand what it is that you want to achieve. Could you please be more specific on the expected results.

Sorry. I’m rubbish at writing and should really sit on my posts before rereading them and clicking submit. I’ll edit it for clarity.

=IF(U4="",ROW(U4),"")

Try drag the formula downwards WITH HOLD DOWN CTRL-key