How to add serial numbers in particular column

Thanks, but I have a doubt… as a first step i have to count no of rows till subtotal row in excel, based on the no of row count i have to update the serial number. can i do that using the above method