=SUBSTITUTE(SUMPRODUCT(ISNUMBER(FIND(ROW($1:$9),A1)*FIND(ROW($1:$9),B1))*ROW($1:$9)*10^(9-ROW($1:$9))),0,"")&IF(ISNUMBER(FIND(0,A1)*FIND(0,B1)),0,"")