excel_芳婷 发表于 2015-5-10 17:02
=IF(IF(ISERR(A1),,IF(A1,COUNTIF(OFFSET(Sheet1!A1,MATCH("标准答案*",Sheet1!A2:A$8000,),),"*"&LEFT(S ...
IF(ISERR(A1),,IF(A1,COUNTIF(OFFSET(Sheet1!A1,MATCH("标准答案*",Sheet1!A2:A$8000,),),"*"&LEFT(Sheet1!A1)&"*"),AND(IF(LEFT(Sheet1!A1,4)<>"标准答案",TRUE,CODE(RIGHT(Sheet1!A1))>71),Sheet1!A1<>"正确",Sheet1!A1<>"错误")))
是判断条件,只有成立的行才会取文
当试卷a列空行时,a1得错误值,这就是ISERR(A1)
a列判断起始字是否为A-F(选项),code值在65-70间,这就是a1公式TEXT(CODE(原卷!A1),"[<65];[>70];")
是选项时,找紧邻标准答案行,即MATCH("标准答案*",Sheet1!A2:A$8000,)(通配符用法,见match帮助),OFFSET(Sheet1!A1,MATCH("标准答案*",Sheet1!A2:A$8000,),)则取该行的值,然后用countif判断本选项字母,即LEFT(Sheet1!A1),是否在紧邻的标准答案中,就有了:COUNTIF(OFFSET(Sheet1!A1,MATCH("标准答案*",Sheet1!A2:A$8000,),),"*"&LEFT(Sheet1!A1)&"*")
这也是countif的通配符用法,见函数帮助
|