跨多列Excel“IF”语句

时间:2018-01-15 20:16:25

标签: excel if-statement

我正在尝试使用(80%)或.80阈值制作IF语句来检查5列。

1            2           3           4          5

0.821282128 0.118611861 0.02990299  0.0070007   0.02320232

我试过用这个:

=IF(E130>0.8, "A", IF(F130>0.8, "B", IF(G130>0.8, "C", IF(H130>0.8, "D", IF(I130>0.8, "E")))))

=IF(AND(E30>0.8),"A",IF(AND(F30>0.8),"B",IF(AND(G30>0.8),"C",IF(AND(H30>0.8),"D",IF(AND(I30>0.8),"E","NA")))))

无法让此声明发挥作用。

2 个答案:

答案 0 :(得分:1)

你只是想找到第一场比赛吗?如果是这样,您可以使用此公式,如果需要,它将更容易扩展到更大的范围

=INDEX({"A","B","C","D","E"},MATCH(TRUE,INDEX(E130:H130>0.8,0),0))

答案 1 :(得分:0)

我认为问题在于你错过了E中的条款,如果找不到它,你会产生一个空白:

  /**
 * This method is called when the save score button after first, second and third set is clicked.
 */

public void saveSetScore(View view) {

    if(currentSet == 1) {
        String firstSetMessage = "1st Set " + scoreTeamA + " Team A | " + scoreTeamB + " Team B";
        displayMessage(firstSetMessage);
    }

    else if(currentSet == 2) {
        String secondSetMessage = "2nd Set " + scoreTeamA + " Team A | " + scoreTeamB + " Team B";
        displayMessage(secondSetMessage);
    }

    else if(currentSet == 3) {
        String thirdSetMessage = "3rd Set " + scoreTeamA + " Team A | " + scoreTeamB + " Team B";
        displayMessage(thirdSetMessage);
    }


}


/**
 * resets the set score of Team A and B to 0
 */
public void resetTheSet(View view) {

    scoreTeamA = 0;
    scoreTeamB = 0;
    displayForTeamA(scoreTeamA);
    displayForTeamB(scoreTeamB);

    currentSet = (currentSet + 1);

}

public void resetTheGame(View view) {

    scoreTeamA = 0;
    scoreTeamB = 0;
    displayForTeamA(scoreTeamA);
    displayForTeamB(scoreTeamB);

    String firstSetMessage = "1st Set";
    displayMessage(firstSetMessage);
    String secondSetMessage = "2nd Set";
    displayMessage(secondSetMessage);
    String thirdSetMessage = "3rd Set";
    displayMessage(thirdSetMessage);

    currentSet = 1;
}

我确认它可以正常工作,但是如果所有5个单元格都小于或等于0.8,那么你会得到FALSE。