=IF(AND((MID(D2,1,1)=MID(D2,2,1)),(MID(D2,1,1)=RIGHT(D2,1)),(MID(D2,1,1)=MID(D2,LEN(D2)-1,1))),"前后两同",IF(AND((MID(D2,1,1)=MID(D2,2,1)),(MID(D2,1,1)=MID(D2,3,1)),(MID(D2,1,1)=MID(D2,4,1))),"前四相同",IF(AND((RIGHT(D2,1)=MID(D2,LEN(D2)-1,1)),MID(D2,LEN(D2)-1,1)=MID(D2,LEN(D2)-2,1),RIGHT(D2,1)=MID(D2,LEN(D2)-3,1)),"后四同",IF(AND(MID(D2,1,1)=MID(D2,2,1),MID(D2,1,1)=MID(D2,3,1),MID(D2,1,1)=MID(D2,4,1),MID(D2,1,1)=RIGHT(D2,1),MID(D2,1,1)=MID(D2,LEN(D2)-1,1),MID(D2,1,1)=MID(D2,LEN(D2)-2,1),MID(D2,1,1)=MID(D2,LEN(D2)-3,1)),"都相同",IF(AND((RIGHT(D2,1)=MID(D2,LEN(D2)-1,1)),MID(D2,LEN(D2)-1,1)=MID(D2,LEN(D2)-2,1)),"后三同",IF(AND(MID(D2,1,1)=MID(D2,2,1),MID(D2,1,1)=MID(D2,3,1),MID(D2,2,1)=MID(D2,3,1)),"前三相同",IF(MID(D2,1,1)=MID(D2,2,1),"前两相同",IF(RIGHT(D2,1)=MID(D2,LEN(D2)-1,1),"右两相同","普通"))))))))
IF(AND((MID(D2,1,1)=MID(D2,2,1)),(MID(D2,1,1)=RIGHT(D2,1)),(MID(D2,1,1)=MID(D2,LEN(D2)-1,1))),"前后两同“
IF(AND((MID(D2,1,1)=MID(D2,2,1)),(MID(D2,1,1)=MID(D2,3,1)),(MID(D2,1,1)=MID(D2,4,1))),"前四相同"
IF(AND((RIGHT(D2,1)=MID(D2,LEN(D2)-1,1)),MID(D2,LEN(D2)-1,1)=MID(D2,LEN(D2)-2,1),RIGHT(D2,1)=MID(D2,LEN(D2)-3,1)),"后四同"
IF(AND(MID(D2,1,1)=MID(D2,2,1),MID(D2,1,1)=MID(D2,3,1),MID(D2,1,1)=MID(D2,4,1),MID(D2,1,1)=RIGHT(D2,1),MID(D2,1,1)=MID(D2,LEN(D2)-1,1),MID(D2,1,1)=MID(D2,LEN(D2)-2,1),MID(D2,1,1)=MID(D2,LEN(D2)-3,1)),"都相同"
IF(AND((RIGHT(D2,1)=MID(D2,LEN(D2)-1,1)),MID(D2,LEN(D2)-1,1)=MID(D2,LEN(D2)-2,1)),"后三同"
IF(AND(MID(D2,1,1)=MID(D2,2,1),MID(D2,1,1)=MID(D2,3,1),MID(D2,2,1)=MID(D2,3,1)),"前三相同"
IF(MID(D2,1,1)=MID(D2,2,1),"前两相同"
IF(RIGHT(D2,1)=MID(D2,LEN(D2)-1,1),"右两相同"