IF Function – ExcelCSE.com https://excelcse.com The Ultimate Guide How to Use Excel Better Thu, 25 Apr 2019 06:25:30 +0000 en-US hourly 1 https://wordpress.org/?v=4.9.10 Calculate Number of Days, Weeks, Months and Years Between Two Dates in Excel https://excelcse.com/number-of-days-weeks-months-and-years-between-two-dates/ Thu, 25 Apr 2019 06:25:30 +0000 https://excelcse.com/?p=1345 Calculate Number of Days Between Two Dates Excel has a function that calculates the number of days between two dates, the DATEDIF function. The Formula =DATEDIF(A2,B2,"d") You got the number of days between two dates, but there is one problem, cell C4 returns an error. Error #NUM! happens because the end date is earlier than the start date. To fix the #NUM! Error, the solution is to use the subtraction formula. Excel stores date values as an integer number, to find out the number of days between two dates use the subtraction formula. The Formula =B2-A2 Look at cell C4,

The post Calculate Number of Days, Weeks, Months and Years Between Two Dates in Excel appeared first on ExcelCSE.com.

]]>
Calculate Number of Days, Weeks, Months and Years Between Two Dates in Excel

Calculate Number of Days, Weeks, Months and Years between Two Dates

Calculate Number of Days Between Two Dates

Excel has a function that calculates the number of days between two dates, the DATEDIF function.

Number of Days between Two Dates

The Formula

=DATEDIF(A2,B2,"d")

You got the number of days between two dates, but there is one problem, cell C4 returns an error. Error #NUM! happens because the end date is earlier than the start date.

Please read the article below for a more detailed explanation for DATEDIF function

To fix the #NUM! Error, the solution is to use the subtraction formula. Excel stores date values as an integer number, to find out the number of days between two dates use the subtraction formula.

Number of Days between Two Dates

The Formula

=B2-A2

Look at cell C4, the DATEDIF function returns a #NUM error, but with subtraction formula, there is no error but a negative number.

Calculate Number of Weeks Between Two Dates

To calculate the number of weeks between two dates divide the number of days between two dates by number 7. The result is the number of weeks between two dates.

Number of Weeks between Two Dates

The Formula

=(B2-A2)/7

A result is a decimal number, a number of weeks between October 29, 2018, and January 5, 2019, is 9.714286.

Is it possible to get a full week difference and shows the remaining days (that are not up to 1 week)? Of course, Excel can do this, thanks to the QUOTIENT and MOD function.

Number of Weeks between Two Dates

The Formula for weeks column

=QUOTIENT(B2-A2,7)

The Formula for days column

=MOD(B2-A2,7)

Between October 29, 2018, and January 5, 2019, there are nine weeks and five days.

Please read the article below for a more detailed explanation for QUOTIENT and MOD function

Calculate Number of Months Between Two Dates

To calculate the number of months between two dates, you must use the DATEDIF function. You cannot use the division formula that divides the number of days between two dates by 30. Why? Because in a month could be 28, 29, 30 or 31 days.

Number of Months between Two Dates

The Formula

=DATEDIF(A2,B2,"m")

You got a #NUM! error, it means the DATEDIF function unable to do a calculation if the end date is earlier than the start date.

The solution is to change the start date and the end date position if the end date is earlier than the start date. You need the IF function to do this trick.

Number of Months between Two Dates

The Formula

=IF(B2<A2,-1*DATEDIF(B2,A2,"m"),DATEDIF(A2,B2,"m"))

No more #NUM errors and cell C4 can display a negative number :).

The DATEDIF function result is a complete difference. If there is less than 1-month days difference, excel will ignore it.

How to calculate the remaining days that are not up to 1 month? still using the DATEDIF function but the unit argument is “md” (calculating the day difference by ignoring the difference in months).

Number of Months between Two Dates

The formula for days column

=IF(B2<A2,-1*DATEDIF(B2,A2,"md"),DATEDIF(A2,B2,"md"))

Calculate Number of Years Between Two Dates

How to calculate number of years, months and days between two dates?

Number of Years between Two Dates

The Formula for years column

=IF(B2<A2,-1*DATEDIF(B2,A2,"y"),DATEDIF(A2,B2,"y"))

The Formula for months column

=IF(B2<A2,-1*DATEDIF(B2,A2,"ym"),DATEDIF(A2,B2,"ym"))

The Formula for days column

=IF(B2<A2,-1*DATEDIF(B2,A2,"md"),DATEDIF(A2,B2,"md"))

Related Function

Usefull links
  • Microsoft Excel Calculate the Different between Two Dates documentation

The post Calculate Number of Days, Weeks, Months and Years Between Two Dates in Excel appeared first on ExcelCSE.com.

]]>
Excel Divide by Zero Error https://excelcse.com/excel-divide-by-zero-error/ Mon, 12 Nov 2018 01:00:17 +0000 https://excelcse.com/?p=748 Pay attention to the data below. A store sells five products. The beginning stock of each product is 100 pcs. At the end of the month, the clerk calculates the end stock of each product (see column C) and the money earned for each product (see column D). What is the selling price of each product and what is the average selling price for all products sold in that shop? To calculate the selling price, divide the money earned with the items sold. The Formula =D3/(B3-C3) Do a copy (CTRL+C) in cell E3 the do a paste (CTRL+V) in range

The post Excel Divide by Zero Error appeared first on ExcelCSE.com.

]]>
How to Solve Excel Divide by Zero Error

Excel Divide by Zero

Pay attention to the data below. A store sells five products. The beginning stock of each product is 100 pcs. At the end of the month, the clerk calculates the end stock of each product (see column C) and the money earned for each product (see column D).

What is the selling price of each product and what is the average selling price for all products sold in that shop?

Excel Divide by Zero Error

To calculate the selling price, divide the money earned with the items sold.

The Formula

=D3/(B3-C3)

Do a copy (CTRL+C) in cell E3 the do a paste (CTRL+V) in range E4:E7.

The Result

Divide by Zero Excel

There is a divide by zero error in cell E5 (no items sold for product C).

***

To find out the average selling price of the five products, you can use the AVERAGE function.

The Formula

=AVERAGE(E3:E7)

The Result

Excel Avoid Divide by Zero

It turns out that the AVERAGE function also returns a divide by zero error. How to solve this problem? Errors in cell E5 cause the same error when calculating the average selling price.

Solution #1, using IF Function

This solution is used to avoid an excel divide by zero error from appearing, by modifying a formula that calculates the selling price. If the items sold are equal to 0, no need to do a division operation, otherwise do a division operation.

The Formula

=IF(B3-C3=0,"No Sales",D3/(B3-C3))

The Result

Excel Average Divide by Zero

If there are no sales, the formula above displays “No Sales”, you can choose other words, but don’t use a number (i.e., 0 or other numbers), because will affect the calculation of the average selling price.

When the formula for calculating the selling price is modified, a #DIV/0! error in cell E5 disappears. The same error in cell E9 also disappears, displays the average selling price for the five products.

Solution #2, using IFERROR Function

Just like solution #1, solution #2 avoid divide by zero error from appearing.

The Formula

=IFERROR(D3/(B3-C3),"No Sales")

The Result

Excel Divide by Zero

The result is the same as solution # 1, the divide by zero error disappears in cells E5 and E9.

Other alternatives, you can use the IF function and the ISERROR function, the results are the same.

The Formula

=IF(ISERROR(D3/(B3-C3)),"No Sales",D3/(B3-C3))

Solution #3, using AGGREGATE Function

Solution #3 is different from the two previous solutions. This solution lets the excel divide by zero error appear. Change the formula in cell E9 from the AVERAGE function to the AGGREGATE function.

The Formula

=AGGREGATE(1,6,E3:E7)

The Result

Excel Divide by Zero Error

The Excel divide by zero error still appears in cell E5, but cell E9 displays the correct average selling price.

The solution is in options argument; there are several choices, number 6 is “Ignore error values”, meaning if there is an error in range E3:E7 the AGGREGATE function will ignore it.

Solution #4, using Array Formula

Solution #4 is the same as solution #3, leaving the excel divide by zero error still there and modifying the formula to calculate the average selling price using an array formula.

The Formula

=AVERAGE(IFERROR(E3:E7,"No Sales"))

The formula above is an array formula. 
It must be ended by pressing the CTRL+SHIFT+ENTER key together.

The Result

Divide by Zero Excel

How does the array formula work?

Solution #4 uses the same function as solution #2, i.e., the IFERROR function and the AVERAGE function. Solution #2 uses the IFERROR function first to calculate the selling price of each product, then use the AVERAGE function to calculate the average selling price.

The array formula in solution #4 can combine both functions in one formula. To find out how does the formula works, edit the formula in cell E9.

Block the IFERROR function, then press the F9 key.

The IFERROR function changes to an array with 5 data 10, 12, “No Sales”, 14, 15. Compare this with the results of the IFERROR function in solution #2, can you find any differences? The result is the same. The five data are calculated by the AVERAGE function to get the average selling price.

Block the AVERAGE function, then press the F9 key. The result is the average selling price.

The animation below explains how array formula array work.

Excel Avoid Divide by Zero

Which One is the Best Solution?

If you want the excel divide by zero error does not appear, then use solution #1 or solution #2. Both return the same results. Which one is the best? It’s up to you, choose one for your solution.

If you want to keep the excel divide by zero error, then use solution #3 or solution #4. For me, solution #3 is easier; it’s only an Excel function with three arguments. Solution #4 is more complicated then solution #3; it involves two functions and an array formula. My advice is to use the AGGREGATE function.

When to choose an array formula compared to the AGGREGATE function?

The AGGREGATE function only provides 19 functions; if the desired function not in the list, then it’s time to use an array formula. Array formula able to use all functions that Excel has.

Practice File Download

Related Function

The post Excel Divide by Zero Error appeared first on ExcelCSE.com.

]]>
How to Determine If a Number is Even or Odd https://excelcse.com/how-to-determine-if-a-number-is-even-or-odd/ Fri, 19 Oct 2018 01:00:02 +0000 https://excelcse.com/?p=525 What are Odd and Even Numbers? Even numbers definition Even numbers are numbers that are always divisible by 2. No reminder always returns integer number. Odd numbers definition Odd numbers are numbers that are not multiples of 2. If divided by the number two, always there is a fraction in the result. Is Zero an Even Number? If you divide 0 by number 2, the result is always 0 and is corresponding to the definition of an even number, no remainder if divided by the number 2. So, zero is an even number. Solution Using MOD Function You can use

The post How to Determine If a Number is Even or Odd appeared first on ExcelCSE.com.

]]>
How to Determine If a Number is Even or Odd
How to Determine If a Number is Even or Odd

What are Odd and Even Numbers?

Even numbers definition

Even numbers are numbers that are always divisible by 2. No reminder always returns integer number.

Odd numbers definition

Odd numbers are numbers that are not multiples of 2. If divided by the number two, always there is a fraction in the result.

Is Zero an Even Number?

If you divide 0 by number 2, the result is always 0 and is corresponding to the definition of an even number, no remainder if divided by the number 2. So, zero is an even number.

Solution Using MOD Function

You can use the MOD function to determine an odd or even number by utilizing even number characteristics, which are always divisible by the number 2.

The MOD function is used to find out if there is a remainder after the division operation. If a number is divided by 2 and there is no remainder, then that is an even number.

Please See the image below for the results of the MOD function with divisor argument 2

Is 0 Even or Odd

The Formula

=MOD(A2,2)

The MOD function returns 0 is an even number, and the one returns 1 is an odd number.

For the more informative result, please add the IF function.

Is 0 an Even or Odd Number

The Formula

=IF(MOD(A2,2)=0,"Even","Odd")

Solution Using ISODD Function

The ISODD function is a special function made by Excel to check whether a number is an odd number or not. Only has one argument, which is the number to be checked.

If the ISODD function returns TRUE, then the checked number is odd, otherwise is even.

The result is as shown below

Odd Numbers Definition

The Formula

=ISODD(A2)

Please add the IF function for more informative results

What are Odd Numbers

The Formula

=IF(ISODD(A2),"Odd","Even")

Solution Using ISEVEN Function

The ISEVEN function is the opposite of the ISODD function, returns TRUE if the number is even and false if the number is odd.

The result is as shown below

Even Numbers Definition

The Formula

=ISEVEN(A2)

Please add the IF function for more informative results

What are Even Numbers

The Formula

=IF(ISEVEN(A2),"Even","Odd")

Which One is the Best?

Excel provides three functions to check whether a number is odd/even. Nothing stands out among the three.

You can choose any function to check whether a number is odd/even.

Related Function

The post How to Determine If a Number is Even or Odd appeared first on ExcelCSE.com.

]]>
Multiple IF Statements in Excel https://excelcse.com/multiple-if-statements-in-excel/ Sun, 07 Oct 2018 01:00:42 +0000 https://excelcse.com/?p=229 What is Multiple IF Statements? Multiple IF statements are also known as “Nested IF Statement” is a formula containing 2 or more IF functions. A single IF function only analyze two criteria. If there are more than two criteria, then it should use the multiple IF statements (nested IF). The number of IF functions required in multiple IF statements is the number of criteria minus 1. Multiple IF Statements in Excel What is the weight category of each name below based on BMI value? to get the value of BMI, divide the weight (in KG) by the height (in Meter2)

The post Multiple IF Statements in Excel appeared first on ExcelCSE.com.

]]>
How to Do Multiple IF Statements in Excel

Multiple IF Statements in Excel

What is Multiple IF Statements?

Multiple IF statements are also known as “Nested IF Statement” is a formula containing 2 or more IF functions. A single IF function only analyze two criteria. If there are more than two criteria, then it should use the multiple IF statements (nested IF). The number of IF functions required in multiple IF statements is the number of criteria minus 1.

For those who do not understand yet a single IF function, please read the following article

Multiple IF Statements in Excel

What is the weight category of each name below based on BMI value? to get the value of BMI, divide the weight (in KG) by the height (in Meter2)

Nested IF Statements

The following is a weight category based on BMI value.

Nested IF Excel

There are six criteria means it takes 5 IF function to assemble multiple IF statements.

IF Function #1 – Underweight or Not

The first IF function looking for “Who has Underweight Body and Who is Not.”

Here are the steps to write the first IF function.

  • Place the cursor in cell E2
  • Type the formula for the IF Function
  • logical_test argument, analyze whether the BMI value is less than 18.5?, type D2<18.5
  • value_if_true argument, type “Underweight”
  • value_if_false argument, type “” (blank space)

Look below for the resulting formula

=IF(D2<18.5,"Underweight","")

Do a copy in cell E2, then do a paste in range E3:13. The results are as shown below.

Excel Nested IF Statements

The result is two names in “Underweight” category; the other ten names are not in the underweight category. There are five possibilities; it could be Normal, Overweight, Class I Obesity, Class II Obesity or Class III Obesity.

Who has the ideal body? Second IF function answer the question.

IF Function #2 – Normal Weight or Not

The second IF function fills the value_if_false argument of the first IF function. The second IF function is searching “Who has Normal Weight Body and Who is Not.”

Here are the steps to write the second IF function.

  • Edit the formula in cell E2 by pressing F2 key
  • Change value_if_false argument of first IF function from “” to the second IF function
  • logical_test argument, analyze whether the BMI value is less than 25, D2<25
  • value_if_true argument, type “Normal”
  • value_if_false argument, type “” (blank space)

Look below for the resulting formula

=IF(D2<18.5,"Underweight"
,IF(D2<25,"Normal",""))

Do a copy in cell E2, then do a paste in range E3:13. The results are as shown below.

Multiple IF Statements

Two names in “Normal Weight” category and there are already four names and their weight category.

There are eight other names with no weight category. There are four possibilities; it could be Overweight, Class I Obesity, Class II Obesity or Class III Obesity.

Who has the overweight body? Third IF function answer the question.

IF Function #3 – Overweight or Not

The third IF function takes the value_if_false argument of the second IF function, seeking “Who has Overweight Body and Who is Not.”

Here are the steps to write the third IF function.

  • Edit the formula in cell E2 by pressing F2 key
  • Change value_if_false argument of second IF function from “” to the third IF function
  • logical_test argument, analyze whether the BMI value is less than 30, D2<30
  • value_if_true argument, type “Overweight”
  • value_if_false argument, type “” (blank space)

Look below for the resulting formula

=IF(D2<18.5,"Underweight"
,IF(D2<25,"Normal"
,IF(D2<30,"Overweight","")))

Do a copy in cell E2, then do a paste in range E3:13. The results are as shown below.

Nested IF

Two additional names appear in “Overweight” category. There were six names known their weight category; there are still six other names not yet known. There are three possibilities left; it could be Class I Obesity, Class II Obesity or Class III Obesity.

Who has the class I obesity body? Fourth IF function answer the question.

IF Function #4 – Class I Obesity or Not

The fourth IF function occupies the value_if_false argument of the third IF function. The fourth IF function seeking “Who has a Class I Obesity Body and Who is Not.”

Here are the steps to write the fourth IF function.

  • Edit the formula in cell E2 by pressing F2 key
  • Change value_if_false argument of third IF function from “” to the fourth IF function
  • logical_test argument, analyze whether the BMI value is less than 30, D2<35
  • value_if_true argument, type “Class I Obesity”
  • value_if_false argument, type “” (blank space)

Look below for the resulting formula

=IF(D2<18.5,"Underweight"
,IF(D2<25,"Normal"
,IF(D2<30,"Overweight"
,IF(D2<35,"Class I Obesity",""))))

Do a copy in cell E2, then do a paste in range E3:13. The results are as shown below.

Excel Multiple IF

Again, two additional names appear, but in “Class I Obesity” category. There were eight names known their weight category; there are four names remain unknown. There are remaining two possibilities; it could be Class II Obesity or Class III Obesity.

Who has the class II obesity body? Fifth IF function answer the question.

IF Function #5 – Class II Obesity or Class III Obesity

The fifth IF function, the last IF function to determine weight category for each name, it takes the value_if_false argument of the fourth IF function, looking for “Who has a Class II Obesity Body and Who is Not.”

Here are the steps to write the fifth IF function.

  • Edit the formula in cell E2 by pressing F2 key
  • Change value_if_false argument of fourth IF function from “” to the fifth IF function
  • logical_test argument, analyze whether the BMI value is less than 30, D2<40
  • value_if_true argument, type “Class II Obesity”
  • value_if_false argument, type “” (blank space)

Look below for the resulting formula

=IF(D2<18.5,"Underweight"
,IF(D2<25,"Normal"
,IF(D2<30,"Overweight"
,IF(D2<35,"Class I Obesity"
,IF(D2<40,"Class II Obesity","")))))

Do a copy in cell E2, then do a paste in range E3:13. The results are as shown below.

Nested IF Function

There are still two names and unknown weight category, all if function already used. “Who has a Class III Obesity Body,” which if function answer this question?

If only one weight category left, then the last one takes the value_if_false argument of the fifth IF function.

Edit the formula in cell E2, change the value_if_false argument of fifth IF function from “” to “Class III Obesity.”

Look below for the resulting formula.

=IF(D2<18.5,"Underweight"
,IF(D2<25,"Normal"
,IF(D2<30,"Overweight"
,IF(D2<35,"Class I Obesity"
,IF(D2<40,"Class II Obesity","Class III Obesity")))))

Do a copy in cell E2, then do a paste in range E3:13. The results are as shown below.

Excel IF Multiple Conditions

Formula Challenge!!!

All IF functions above use the “<” operator. Is it possible to use “>”, “<=” or “> =” operator for multiple if statement above?

The result should not be different.

Video Tutorial for Multiple IF Statements

Here is a video explains step by step writing multiple IF statements one by one from the first IF function until the fifth IF function

The next video explains how to write all the IF functions at once

Another Alternative for Multiple IF Statements

IFS Function

The IFS function is available if you have an Office 365 subscription, make sure you have the latest version of Office 365. Microsoft provides the IFS function as an alternative and an improvement of nested IF, no need to use multiple IF statements to analyze more than two criteria.


With the same example above, what is the weight category of each name below based on BMI value? Here is a solution using the IFS function. Look below for the resulting formula.

=IFS(D2<18.5,"Underweight"
,D2<25,"Normal"
,D2<30,"Overweight"
,D2<35,"Class I Obesity"
,D2<40,"Class II Obesity"
,TRUE,"Class III Obesity")

Excel IF Statement Multiple Conditions Range

It makes no difference, multiple IF statements result and IFS function result.

For a more detailed explanation about the IFS function, please read the article below

VLOOKUP Function

The VLOOKUP function instead of multiple IF statements? Yes, you are not wrong, you can use VLOOKUP function to analyze more than two criteria. The key is the TRUE value for the range_lookup argument.

Using the same example as the previous case, what is the weight category of each name below based on BMI value?. Here is a solution using the VLOOKUP function. Look below for the resulting formula.

=VLOOKUP(D12,$A$3:$C$8,3,TRUE)

Excel IF Function Multiple Conditions

What is the difference? The multiple IF statements vs. the VLOOKUP function result.

For a more detailed explanation about the VLOOKUP function, please read the article below

Which One is the Best to Analyze more than 2 Criteria

Multiple IF Statements vs. IFS Function vs. VLOOKUP Function, which one is your choice?

Multiple IF statements tend to be difficult to use for the inexperienced, especially more than 5 IF functions in a formula. The biggest weakness of nested IF is there is a maximum limit. Before Excel 2007, seven is the maximum number in one formula, after Excel 2007 you can use up to 64 IF functions in one formula.

Although the latest version of Excel can accommodate a lot of IF functions, multiple IF statements are not the best solution, try to avoid it as much as possible.

The IFS function is an improvement for multiple IF statements provided by Microsoft, able to analyze up to 127 criteria. The disadvantage appears if there are any additional criteria; all formula must be edited to accommodate the addition of new criteria.

What about the VLOOKUP function? What is the maximum number of criteria allowed to be analyzed? If there is a new criterion added, should the formula be edited?

There are no maximum criteria for the VLOOKUP function; the number of rows in the excel worksheet is the limitation.

Look at the VLOOKUP function above, a VLOOKUP function and a table answering all the questions. If there are new criteria, then add the criteria in the table, by using the dynamic named range, no need to change the formula at all.

For me VLOOKUP is my choice, what is yours?

Related Function

Function used in this article
Usefull links
  • Microsoft Nested IF Function Documentation

The post Multiple IF Statements in Excel appeared first on ExcelCSE.com.

]]>
Excel IF Statement https://excelcse.com/excel-if-statement/ Fri, 05 Oct 2018 01:00:07 +0000 https://excelcse.com/?p=139 What is the Excel IF Function? The IF function is a logical function to analyze a condition. If the condition met the criteria (TRUE) return value_if_true argument, otherwise (FALSE) return value_if_false argument. IF Syntax IF(logical_test, , ) logical_test (required), the condition you want to analyze, are in accordance with the criteria. The result is a TRUE / FALSE value. value_if_true (required), returned value if logical test is TRUE value_if_false (optional), returned value if logical test is FALSE. value_if_false argument is optional, if omitted then return FALSE. How to Use IF Function in Excel IF Then Statements Examples (One Criteria) For

The post Excel IF Statement appeared first on ExcelCSE.com.

]]>
How to Write Excel IF Statement

How to Use IF Function in Excel

What is the Excel IF Function?


The IF function is a logical function to analyze a condition. If the condition met the criteria (TRUE) return value_if_true argument, otherwise (FALSE) return value_if_false argument.

IF Syntax

IF(logical_test, [value_if_true], [value_if_false])

logical_test (required), the condition you want to analyze, are in accordance with the criteria. The result is a TRUE / FALSE value.

value_if_true (required), returned value if logical test is TRUE

value_if_false (optional), returned value if logical test is FALSE. value_if_false argument is optional, if omitted then return FALSE.

How to Use IF Function in Excel

IF Then Statements Examples (One Criteria)

For example, there are data such as the image below.

Excel IF Statement Example

Who has an overweight body? According to the BMI, overweight body has a BMI value greater than or equal to 25.

To find out anyone who has overweight body, no need to use IF function. Simply use the >= operator, you can find out who has overweight body, but the result is not informative, showing only TRUE/FALSE value, for the more informative result you can use Excel IF Statement

How to Use IF Function

There are only 1 criteria, i.e. BMI>=25, showing “Overweight” text. If there are BMI value less than 25, IF function return nothing. Here are the steps how to use the IF function in excel.

  • Place the cursor in cell E2
  • Type the formula for IF function
  • logical_test argument, type criteria #1 D2>=25
  • value_if_true argument, type “Overweight”
  • value_if_false argument, type nothing/blank space “”

If the formula is typed correctly, it will look like below

=IF(D2>=25,"Overweight","")

Do a copy in E2 then do a paste in range E3:E9. The results are as shown below.

More informative result, not just TRUE/FALSE values.

Excel IF AND Statements Examples (Two Criteria, ALL Must be TRUE)

With the same data as the previous example. The question is who has the ideal body weight?

The Ideal body weight has BMI value greater than or equal 18.5 AND less than or equal 24.9. Look like there are many criteria, but essentially there are only 2 criteria, i.e. ideal and no ideal body weight. The ideal body weight is determined by 2 criteria (BMI>=18.5 and BMI<=24.9) both must be TRUE. Use the AND function to evaluate both criteria.

Here are the steps using the IF function with the AND function in the logical_test argument.

  • Place the cursor in cell E2
  • Type the formula for the IF function
  • The logical_test argument, fill with AND function and both criteria, AND(D2>=18.5,D2<=24.9)
  • The value_if_true argument, Type “Ideal”
  • The value_if_false argument, Type nothing/blank space “”

If the formula is typed correctly, it will look like below

=IF(AND(D2>=18.5,D2<=24.9),"Ideal","")

Do a copy in E2 then do a paste in range E3:E9. The results are as shown below.

Compare with the AND function results in the “How to Use AND Function” article. Which one is more informative, and which one is your choice? 🙂

Excel IF OR Statements Examples (Two Criteria, One Must be TRUE)


With the same data as the previous example. The question is who has no ideal body weight?

The No Ideal body weight has BMI value less than 18.5 OR greater than 24.9. There are 2 criteria, i.e. ideal and no ideal body weight, same as the previous example but with different questions. The no ideal body weight is determined by 2 criteria (BMI<18.5 or BMI>24.9) one of them must be TRUE. Use the OR function to evaluate both criteria.

Here are the steps using the IF function with the OR function in the logical_test argument.

  • Place the cursor in cell E2
  • Type the formula for the IF function
  • The logical_test argument, fill with OR function and both criteria, OR(D2<18.5,D2>24.9)
  • The value_if_true argument, Type “No Ideal”
  • The value_if_false argument, Type nothing/blank space “”

If the formula is typed correctly, it will look like below

=IF(OR(D2<18.5,D2>24.9),"No Ideal","")

Do a copy in E2 then do a paste in range E3:E9. The results are as shown below.

Compare with the OR function results in the “How to Use OR Function” article. Which one is more informative, OR function result or IF function result 🙂

Multiple IF Statements in Excel


With the same data as the previous example, does the IF function able to determine the weight categories of each name according to BMI value?

How to Do IF Function in Excel

Of course, IF function able to do it. There are 6 criteria, because the IF function is only able to analyze 2 criteria, then it takes more than 1 IF function know as Multiple IF Statements or Nested IF Statements.

The number of required IF function is the number of criteria minus 1. There are 6 criteria, so it takes 5 IF function to determine the weight category for each name.

IF Statement Example

For more details explanation, please read the following article:

Another Logical Function

Usefull links
  • Microsoft IF Function Documentation

The post Excel IF Statement appeared first on ExcelCSE.com.

]]>