IF functions in Google Spreadsheets can be used to set up a basic “IF-THEN” statement. The function is written as: =IF(logical expression, outcome if true, outcome if false).
Here I have used the IF function to test whether or not students pass a test, based on their test scores. If the value in the B column or “test score column” exceeds 50% they pass and otherwise they fail.
To setup multiple “IF-THEN” statements, you can use the IFS function, written as: =IFS(logical expression 1, outcome if expression 1 is true, logical expression 2, outcome if expression 2 is true).
Just remember that this will be read from left, to right, meaning that if logical expression 1 is true, outcome 1 will be chosen even if expression 2 is also true.
Here I have used the IFS function to assign grades to the students based on test scores, starting from 10 and working my way down. If I did it the other way, everyone that pass would receive a 5 (found that out the hard way!)
5 окт 2024