【紧急】求助大神!!!复杂的EXCEL表格公式 88
你这个 0 1 2识别出半顺了。
=IF(OR(COUNTIF(A2:C2,A2:C2)=3),"豹子",IF(OR(COUNTIF(A2:C2,A2:C2)=2),"对子",IF(OR(AND(SMALL(IF(A2:C2=0,10,A2:C2),{3,2})-SMALL(IF(A2:C2=0,10,A2:C2),{2,1})=1),AND(COUNTIF(A2:C2,{0,1,9})=1),AND(COUNTIF(A2:C2,{0,1,2})=1)),"顺子",IF(OR(SMALL(IF(A2:C2=0,10,A2:C2),{3,2})-SMALL(IF(A2:C2=0,10,A2:C2),{2,1})=1),"半顺","杂六"))))
再单独添加0 1 2 的顺子情况
你的这个问题还应该包括890这样的顺子的吧!
按你的描述,假设3个数据是在A1、B1、C1单元格的,则可在D1单元格输入数组公式:
=IF(LEN(A1&B1&C1)=0,"",IF(A1=B1,IF(B1=C1,"豹子","对子"),IF(B1=C1,"对子",IF(OR(MAX(A1:C1)-MIN(A1:C1)=2,MAX(MOD(A1:C1+1,10))-MIN(MOD(A1:C1+1,10))=2,MAX(MOD(A1:C1+2,10))-MIN(MOD(A1:C1+2,10))=2),"顺子",IF(OR(SUMPRODUCT({1,-1}*LARGE(A1:C1,COLUMN(A:B)))=1,SUMPRODUCT({-1,1}*SMALL(A1:C1,COLUMN(A:B)))=1,SUMPRODUCT({1,-1}*LARGE(MOD(A1:C1+1,10),COLUMN(A:B)))=1,SUMPRODUCT({-1,1}*SMALL(MOD(A1:C1+1,10),COLUMN(A:B)))=1),"半顺","杂六")))))
记得是数组公式,输入或者粘贴完成必须同时按CTRL+SHIFT+ENTER这3个键结束,否则公式无效的!
=IF(LARGE(A1:C1,1)=SMALL(A1:C1,1),"豹",IF(OR(LARGE(A1:C1,1)=LARGE(A1:C1,2),SMALL(A1:C1,1)=SMALL(A1:C1,2)),"对",IF(OR(LARGE(A1:C1,1)-AVERAGE(A1:C1)=1,AND(LARGE(A1:C1,1)=9,LARGE(A1:C1,2)=1,SMALL(A1:C1,1)=0)),"顺",IF(OR(LARGE(A1:C1,1)-LARGE(A1:C1,2)=1,SMALL(A1:C1,2)-SMALL(A1:C1,1)=1),"半","杂"))))
这个可以,就是有时候会有BUG。0和9有时候判断不出来是连着的,我不知道是那里有问题。