=IF(RIGHT(C3,7)-RIGHT(C2,7)= 1, 1,"")
Drop down the formula to get the invoice quantity with serial number.
Pay attention to the number of digits in the invoice. For example, if it is considered as 7 digits, it can be changed to the actual number of digits.