how can I formulate the second column to generate a code with the same value or duplicate in the first column?
=XMATCH(A2:A10,UNIQUE(A2:A10),0)
Is it possible to get a result with some combination of SUMPRODUCT?
=IF(SUMPRODUCT((A$2:A10=A10)+0)=1,MAX(B$1:B9)+1,VLOOKUP(A10,A$1:B9,2,0))