WPS Office

Free All-in-One Office Suite with PDF Editor

correct-icon

Edit Word, Excel, and PPT for FREE.

correct-icon

Read, edit, and convert PDFs with the powerful PDF toolkit.

correct-icon

Microsoft-like interface, easy to use.

Free download

Windows • MacOS • Linux • iOS • Android

banner

How to use excel IF function with examples

February 13, 2023
5.0K Views

Suppose you have a file and you want to evaluate it such that if true condition is found in file than yes should be returned as true value. You can do that using excel. The Excel IF Statement evaluates a specified condition and outputs two values, one for a true outcome and another for a false one. In other words, it let you compare two values and tells you what you expect from comparison.  For instance, you have your own convenience store and you want to evaluate whether you are getting profit from sales or not. In this condition you can just put your data file in excel spreadsheet and use the IF function. You can specify your true or false value, such as yes for true and no for false. So in that case, profit, if found in file then yes and if you didn’t make profit then no as an answer will be returned.

IF Formula

Here is the general statement for IF formula: =IF(logical test, value if true, value if false)

Here is the detail explanation of the formula.

  1. Logical test: logical test stands for the condition that you are going to test.

  2. Value if true: this is a value that you can specify for a true statement. For example, if you specify “yes” as true value, if thestatement is true condition is found in file then yes will be your return value.

  3. Value if false: this is a value that you can specify for a false statement. For example, if you specify “no” as false value, if the condition found in data file is false then no will be your return value.

You can use these symbols for comparison: = (equal to),  (greater than), = (greater than or equal to),  (not equal to)

How to use IF function

 In this example I have a list of different values and I want to see which one of them is greater than 500 and I will specify yes as true value and no as false value. So, if value greater than 500 if found in file than yes will be returned as true value and no in the case of value lower than 500.

  1. Write a data in a column for which you want to use if function.

2. Write the IF formula for your logical statement. Here I have used =IF(A2>500,”yes”,”no”) as formula, price greater than 500 if found in file than yes will be returned as true value or if  price less than 500 is found in list than no will be returned as false value.

3. Press enter.

4. Use auto fill option to fill the rest of the cells.

Here you can see values above 500 if found in file is returned as yes and no for values lower than 500

Thing you should know about IF function

  1. You have to use inverted comma if you are using any text in function. But this rule has an exception and that is for “true” or “false”, only these text will be detected by excel on its own.

  2. If you want to count conditions, you have to use COUNTIF or COUNTIFS function.

  3. In case you want to add up conditions, you have to use SUMIF or SUMIFS function.

  4. If the statement cannot be estimated as true or false then #VALUE! Error will occur.

  5. The excel if function will also work with numeric values. In that condition, non-zero value is treated as true and zero as false.

You can use WPS spreadsheet for IF function across different platforms such as windows, mac, android and others without being online. Additionally, you can use IF function in 2016/2019 and all other versions.

Did you learn about how to use IF function in excel to return different values, true value if found in file than yes and no as false value? You can follow WPS Academy to learn more features of Word Document, Excel Spreadsheets and PowerPoint Slides.

You can also download WPS Office to edit the word documents, excel, PowerPoint for free of cost. Download now! And get an easy and enjoyable working experience. 

15 years of office industry experience, tech lover and copywriter. Follow me for product reviews, comparisons, and recommendations for new apps and software.