=IF(AND(MID(B2,2,1)=MID(B2,1,1),MID(B2,2,1)=MID(B2,3,1)),5,IF(OR(MID(B2,2,1)=MID(B2,1,1),MID(B2,2,1)=MID(B2,3,1)),6,IF(MID(B2,2,1)>MID(B2,1,1),IF(MID(B2,2,1)>MID(B2,3,1),4,1),IF(MID(B2,2,1)>MID(B2,3,1),2,3))))
=IF(AND(MID(B2,2,1)=MID(B2,1,1),MID(B2,2,1)=MID(B2,3,1)),5,IF(OR(MID(B2,2,1)=MID(B2,1,1),MID(B2,2,1)=MID(B2,3,1)),6,IF(MID(B2,2,1)>MID(B2,1,1),IF(MID(B2,2,1)>MID(B2,3,1),4,1),IF(MID(B2,2,1)>MID(B2,3,1),2,3))))