- HubPages»
- Technology»
- Computers & Software»
- Computer Software»
- Office Software Suites»
- Microsoft Office
Using Simple If Function in Microsoft Office Excel
Use IF function to Grade or Test
The IF function is a tool used to test specified conditions in a given cell in a spreadsheet.
It is a logical test used to test if a condition is true or false. If the condition being tested is true, expected results are displayed and again if the condition is false, a different kind of result is displayed.
After testing the condition of a given cell, the required action is carried out. This action could be executing a formula or entering text on the given cell where the results are expected.
We use the IF condition in our day to day lives only that we do not think about it.
When you say that if you get money at the end of the month you will buy a new laptop, you are using an IF condition.
The condition here is if you get money and the action is buying a laptop. Without money, you will not buy the intended laptop.
If Function Question
IF Function, Statement, or Condition
The IF function, statement, or condition as it is sometimes referred to, is a very important function we have in Excel.
It is available in all versions of Microsoft Office Excel and the procedure of working with it is the same in all versions.
A good scenario case where you can apply it is when you are grading exam results. For instance, that of fifty students.
It can make your work very easy. What you need is only to come up with one IF statement and then auto-fill to the rest of the cells.
In this case, you do not have to keep on checking the results of the students one at a time to determine the grade.
Syntax and Parts of the IF Function
This is how the IF function looks like. =IF(logical_test, value_if_true, value_if_false)
- Logical_test - is any value or expression that can be tested to see if it is TRUE or FALSE. For example, A10>90 is a logical expression; if the value in cell A10 is greater than 90, the expression evaluates to TRUE. Otherwise, if it is less than 90, the results are displayed as FALSE.
- Value_if_true - this is the value that is displayed if the logical_test is true.
- Value_if_false - this is the value that is displayed if the logical_test is false.
An Example of IF Condition
Suppose we are to find the grades of these students using the if function given that:-
- If the total >=90 grade is "A"
- If the total >=80 grade is "B"
- If the total >=70 grade is "C"
- If the total <70 grade is "D"
And their status given that:-
- If grade = A, status then is EXCELLENT
- If grade = B, status then is WELLDONE
- If grade = C, status then is GOOD
- If grade = D, status then is FAIL
Using IF Function
How to Use the IF Function
- You must have the data you are testing already typed in your worksheet. You can copy the example I have here for your use.
- Click on where you want to have your answer.
- At this stage, you can type the IF directly on the cell or you use the IF function wizard. You should try both to see which works best for you.
Typing the IF function
- Click on where the answer will appear and press the equals sign on your keyboard.
- Enter the IF statement as follows without spacing or omitting anything: =IF(B2>=90,"A",IF(B2>=80,"B",IF(B2>=70,"C",IF(B2<70,"D"))))
Using the IF Dialogue Box
- Click on where the answer will appear, then go to the insert function and select the IF function and click okay.
- Input the logical test, B2>=90.
- Input the value if true, what will be displayed "A".
- Input the value if false - IF(B2>=80,"B",IF(B2>=70,"C",IF(B2<70,"D"))) click okay to get your results.
Using the IF Function
Important to Note About IF Condition
- Number arguments are not quoted =IF(B2>=90,"A",IF(B2>=80,"B",IF(B2>=70,"C",IF(B2<70,"D"))))
- Text arguments are quoted - =IF(F2="A","EXCELENT",IF(F2="B","WELLDONE",IF(F2="C","GOOD","FAIL")))
- To know how many brackets to use for closing, count the number of IFs you have.
- You do not have to type the last IF, you can just use a comma and give the expected results.
- When you make simple mistakes, Excel suggests the correct answer for you.
Excel Auto-correction
About IF Condition
Did you Knew how to use the IF Condition prior to reading this?
This content is accurate and true to the best of the author’s knowledge and is not meant to substitute for formal and individualized advice from a qualified professional.
© 2012 Patrick Kamau