Excel IF statement with multiple AND/OR conditions, nested IF formulas, and more

In Part 1 of our Excel IF function tutorial, we started to learn the nuts and bolts of the Excel IF function. As you remember, we discussed a few IF formulas for numbers, dates and text values as well as how to write an IF statement for blank and non-blank cells.

However, for powerful data analysis, you may often need to evaluate multiple conditions at a time, meaning you have to construct more sophisticated logical tests using multiple IF functions in one formula. The formula examples that follow below will show you how to do this correctly. You will also learn how to use Excel IF in array formulas and learn the basics of the IFEFFOR and IFNA functions.

How to use Excel IF function with multiple conditions

In summary, there can be 2 basic types of multiple conditions - with AND and OR logic. Consequently, your IF function should embed an AND or OR function in the logical test, respectively.

  • AND function. If your logical test contains the AND function, Microsoft Excel returns TRUE if all the conditions are met; otherwise it returns FALSE.
  • OR function. In case you use the OR function in the logical test, Excel returns TRUE if any of the conditions is met; FALSE otherwise.

To better illustrate the point, let's have a look at a few IF examples with multiple conditions.

Example 1. Using IF & AND function in Excel

Suppose, you have a table with the results of two exam scores. The first score, stored in column C, must be equal to or greater than 20. The second score, listed in column D, must be equal to or exceed 30. Only when both of the above conditions are met, a student passes the final exam.

The easiest way to make a proper formula is to write down the condition first, and then incorporate it in the logical_test argument of your IF function:

Condition: AND(B2>=20, C2>=30)

IF/AND formula:

=IF((AND(C2>=20, D2>=30)), "Pass", "Fail")

Easy, isn't it? The formula tells Excel to return "Pass" if a value in column C >=20 AND a value in column D >=30. Otherwise, the formula returns "Fail". The screenshot below proves that our Excel IF /AND function is correct:
Excel IF function with multiple AND conditions

Note. Microsoft Excel checks all conditions in the AND function, even if one of the already tested conditions evaluates to FALSE. Such behavior is a bit unusual since in most of programming languages, subsequent conditions are not tested if any of the previous tests has returned FALSE.

In practice, a seemingly correct IF / AND formula may result in an error because of this specificity. For example, the below formula will return "Divide by Zero Error" (#DIV/0!) if cell A2 is equal to 0:

=IF(AND(A2<>0,(1/A2)>0.5),"Good", "Bad")

The avoid this, you should use a nested IF function:

=IF(A2<>0, IF((1/A2)>0.5, "Good", "Bad"), "Bad")

Example 2. Using IF with OR function in Excel

You use the combination of IF & OR functions in a similar way. The difference from the IF / AND formula discussed above is that Excel returns TRUE if at least one of the specified conditions is met.

So, if we modify the above formula in the following way:

=IF((OR(C2>=20, D2>=30)), "Pass", "Fail")

Column E will have the "Pass" mark if either the first score is equal to or greater than 20 OR the second score is equal to or greater than 30.

As you see in the screenshot below, our students have a better chance to pass the final exam with such conditions (Scott being particularly unlucky failing by just 1 point : )
An example of IF/OR formula

More formula examples can be found in Excel IF OR functon.

Example 3. Using IF with AND & OR functions

In case you have to evaluate your data based on several sets of multiple conditions, you will have to employ both AND & OR functions at a time.

In the above table, suppose you have the following criteria to evaluate the students' success:

  • Condition 1: column C>=20 and column D>=25
  • Condition 2: column C>=15 and column D>=20

If either of the above conditions is met, the final exam is deemed passed, otherwise - failed.

The formula might seem tricky, but in a moment, you will see that it is not! You just have to express two conditions as AND statements and enclose them in the OR function since you do not require both conditions to be met, either will suffice:

OR(AND(C2>=20, D2>=25), AND(C2>=15, D2>=20)

Finally, use the above OR function as the logical test in the IF function and supply value_if_true and value_if_false arguments. As the result, you will get the following IF formula with multiple AND / OR conditions:

=IF(OR(AND(C2>=20, D2>=25), AND(C2>=15, D2>=20)), "Pass", "Fail")

The screenshot below indicates that we've got the formula right:
Using IF with OR & AND functions

Naturally, you are not limited to using only two AND/OR functions in your Excel IF formulas. You can use as many logical functions as your business logic requires, provided that:

  • In Excel 2016, 2013, 2010 and 2007, your formula includes no more than 255 arguments, and the total length of the formula does not exceed 8,192 characters.
  • In Excel 2003 and lower, you can use up to 30 arguments and the total length of your formula shall not exceed 1,024 characters.

Using multiple IF statements in Excel (nested IF functions)

If you need to create more elaborate logical tests for your data, you can include additional IF statements in the value_if_true and value_if_false arguments of your Excel IF formulas. These multiple IF functions are called nested IF functions and they may prove particularly useful if you want your formula to return 3 or more different results.

Here's a typical example: suppose you want not simply to qualify the students' results as Pass/Fail, but define the total score as "Good", "Satisfactory" and "Poor". For instance:

  • Good: 60 or more (>=60)
  • Satisfactory: between 40 and 60 (>40 and <60)
  • Poor: 40 or less (<=40)

To begin with, you can add an additional column (E) with the following formula that sums numbers in columns C and D:

=C2+D2

An additional column that sums numbers in columns C and D

And now, let's write a nested IF function based on the above conditions. It's considered a good practice to start with the most important condition and make your functions as simple as possible. Our Excel nested IF formula is as follows:

=IF(E2>=60, "Good", IF(E2>40, "Satisfactory", "Poor "))

As you see, just one nested IF function is sufficient in this case. Naturally, you can nest more IF functions if you want to. For example:

=IF(E2>=70, "Excellent", IF(E2>=60, "Good", IF(E2>40, "Satisfactory", "Poor ")))

The above formula adds one more conditions - the total score of 70 points and more is qualified as "Excellent".

An example of nested IF functions

For more information about Excel IF with multiple conditions, please see How to use nested IF in Excel.

Using Excel IF in array formulas

Like other Excel functions, IF can be used in array formulas. You may need such a formula if you want to evaluate every element of the array when the IF statement is carried out.

For example, the following array SUM/IF formula demonstrates how you can sum cells in the specified range based on a certain condition rather than add up the actual values:

=SUM(IF(B1:B5<=1,1,2))

The formula assigns a certain number of "points" to each value in column B - if a value is equal to or less than 1, it equates to 1 point; and 2 points are assigned to each value greater than 1. And then, the SUM function adds up the resulting 1's and 2's, as shown in the screenshot below.
Using Excel IF in array formulas

Note. Since this is an array formula, remember to press Ctrl + Shift + Enter to enter it correctly.

Using IF function together with other Excel functions

Earlier in this tutorial, we've discussed a few IF formula examples demonstrating how to use the Excel IF function with logical functions AND and OR. Now, let's see what other Excel functions can be used with IF and what benefits this gives to you.

Example 1. Using IF with SUM, AVERAGE, MIN and MAX functions

When discussing nested IF functions, we wrote the formula that returns different ranking (Excellent, Good, Satisfactory or Poor) based on the total score of each student. As you remember, we added a new column with the formula that calculates the total of scores in columns C and D.

But what if your table has a predefined structure that does not allow any modifications? In this case, instead of adding a helper column, you could add values directly in your If formula, like this:

=IF((C2+D2)>=60, "Good", IF((C2+D2)=>40, "Satisfactory", "Poor "))

Okay, but what if your table contains a lot of individual scores, say 5 different columns or more? Summing so many figures directly in the IF formula would make it enormously big. An alternative is embedding the SUM function in the IF's logical test, like this:

=IF(SUM(C2:F2)>=120, "Good", IF(SUM(C2:F2)>=90, "Satisfactory", "Poor "))

Using IF with the SUM function

In a similar fashion, you can use other Excel functions in the logical test of your IF formulas:

IF and AVERAGE:

=IF(AVERAGE(C2:F2)>=30,"Good",IF(AVERAGE(C2:F2)>=25,"Satisfactory","Poor "))

The formulas retunes "Good" if the average score in columns C:F is equal to or greater than 30, "Satisfactory" if the average score is between 29 and 25 inclusive, and "Poor" if less than 25.

IF and MAX/MIN:

To find the highest and lowest scores, you can use the MAX and MIN functions, respectively. Assuming that column F is the total score column, the below formulas work a treat:

MAX: =IF(F2=MAX($F$2:$F$10), "Best result", "")

MIN: =IF(F2=MIN($F$2:$F$10), "Worst result", "")

If you'd rather have both the Min and Max results in the same column, you can nest one of the above functions in the other, for example:

=IF(F2=MAX($F$2:$F$10) ,"Best result", IF(F2=MIN($F$2:$F$10), "Worst result", ""))

Using IF with the MIN and MAX functions

In a similar manner, you can use the IF function with your custom worksheet functions. For example, you can use it with the GetCellColor / GetCellFontColor functions to return different results based on a cell color.

In addition, Excel provides a number of special IF functions to analyze and calculate data based on different conditions.

For example, to count the occurrences of a text or numeric value based on a single or multiple conditions, you can use COUNTIF and COUNTIFS, respectively. To find out a sum of values based on the specified condition(s), use the SUMIF or SUMIFS functions. To calculate the average according to certain criteria, use AVERAGEIF or AVERAGEIFS.

For the detailed step-by-step formula examples, check out the following tutorials:

Example 2. IF with ISNUMBER and ISTEXT functions

You already know a way to spot blank and non-blank cells using the ISBLANK function. Microsoft Excel provides analogous functions to identify text and numeric values - ISTEXT and ISNUMBER, respectively.

Here's is example of the nested Excel IF function that returns "Text" if cell B1 contains any text value, "Number" if B1 contains a numeric value, and "Blank" if B1 is empty.

=IF(ISTEXT(B1), "Text", IF(ISNUMBER(B1), "Number", IF(ISBLANK(B1), "Blank", "")))

Using IF with ISNUMBER, ISTEXT and ISBLANK functions

Note. Please pay attention that the above formula displays "Number" for numeric values and dates. This is because Microsoft Excel stores dates as numbers, starting from January 1, 1900, which equates to 1.

Example 3. Using the result returned by IF in another Excel function

Sometimes, you can achieve the desired result by embedding the IF statement in some other Excel function, rather than using another function in a logical test.

Here's another way how you can use the CONCATINATE and IF functions together:

=CONCATENATE("You performed ", IF(C1>5,"fantastic!", "well"))

I believe you hardly need any explanation of what the formula does, especially looking at the screenshot below:
Using the result returned by IF in another Excel function

IF function vs. IFERROR and IFNA

Both of the functions, IFERROR and IFNA, are used to trap errors in Excel formulas and replace them with another calculation, predefined value or text message. In earlier Excel versions, you can use the IF ISERROR and IF ISNA combinations instead.

The difference is that IFERROR and ISERROR handle all possible Excel errors, including #VALUE!, #N/A, #NAME?, #REF!, #NUM!, #DIV/0!, and #NULL!. While IFNA and ISNA specialize solely in #N/A errors.

Here is the simplest example of the IFERROR formula:

=IFERROR(B2/C2, "Sorry, an error has occurred")

An example of using the IFERROR function in Excel

As you see in the screenshot above, column D displays the quotient of the division of a value in column B by a value in column C. You can also see two error messages in cells D2 and D5 because everyone knows that you cannot divide a number by zero.

In some cases, however, you may not want to trap all errors, but rather test the condition causing a specific error. For example, to replace a divide by zero error with your own message, use the following IF formula:

=IF(C2=0, "Sorry, an error has occurred", B2/C2)

And that's all I have to say about using the IF function in Excel. I thank you for reading and hope to see you on our blog next week!

3,024 responses to "Excel IF statement with multiple AND/OR conditions, nested IF formulas, and more"

  1. Naveed says:

    I need formula like ( my last year leave balance has 10 and current year leave 30 and this year consumed 03 now the balance will be 27 ignore balance another way need formula that if my last year leave -10 (negative) current Year 30 Balance = 20 in one cell Please do the needful.???any one

  2. DJ says:

    I a trying to create an if function in excel 2016 with multiple layers:
    if cell a1>50, cell a1*2,
    if cell a1<50, cell a1*1,
    if cell a1*1<20, must result as 20.

    Please help.

  3. Indy says:

    HI, I am trying to create a formula that looks across a range.
    Example is:
    I have to select one of three different results. FAIL, COMPLETE or CUSTOMER REFUND on a daily basis.
    At the end of the week, I need to have a formula to say that if it has COMPLETE in the range (which are the days) then the final result should be COMPLETE. If it has anything else, it should be FAIL.
    My issue is, that during the week, you could have a FAIL on Monday but a COMPLETE on Friday, so How do I get the formula to ignore the FAIL in this instance.

    • Hi,
      I am not sure I fully understand what you mean. Unfortunately, without seeing your data it is difficult to give you any advice.
      Please have a look at this articles - VLOOKUP with one or more criteria or COUNTIF with multiple criteria.
      Or describe your problem in more detail. Include an example of the source data and the result you want to get. It’ll help me understand your request better and find a solution for you.

      • Indy says:

        Sorry for misunderstanding.
        In the top columns I have the days, in my sheet it would be C3:H3 (Mon-sat)
        In columns A:B I have the customer name and order number.
        So once I enter the order number and go to that particular day, I want to enter FAIL on whatever day the failed delivery was. Then when the problem is resolved I would enter either COMPLETE or CUSTOMER REFUND.
        So at the end of the week against that order in I4,I should be able to see if the order was COMPLETED OR FAIL. So if they had a FAIL and CUSTOMER REFUND that would be COMPLETE, if they had a FAIL and COMPLETE, that would be COMPLETE but if they had a FAIL then that would be COMPLETE.

        I did think maybe if I concatenated the selections, and then did an IF statement, but this is where I am stuck!

  4. Jade says:

    I have a range of cells that results in a text of "(All)"...when a selection is made, one of the range of cells will say something else, like, "January"....is there a way to have multiple conditions AND result in any text shown other than "(All)"?
    Multiple conditions, and the "else" statement would be whatever that shows up other than "(All)"?

    • Hi,
      I’m sorry but your task is not entirely clear to me. For me to be able to help you better, please describe your task in more detail. Please specify what you were trying to find, what formula you used and what problem or error occurred. Give an example of the source data and the expected result.
      It’ll help me understand it better and find a solution for you.

  5. Jeffrey says:

    Hi I am a bit of an excel novice and I, like many, I don't know what I don't know

    I am currently using this formula =IF(I14<$G$9,0,IF(I1465,$W$9))) to determine value in a cell for the following conditions
    - if age (F14) is less than planned retirement age (SG$9) then pension income is $0
    - if age (F14) is <=65 but greater than retirement age ($G$9) then pension income is $T$9
    - if age (F14) is greater than 65, then pension income is $W$9
    But; the stated pension incomes ($T$9 and $W$9) are indexed to inflation and I cannot figure out how to accommodate the ever increasing values. Any suggestions or help would be really appreciated

  6. Business 101 says:

    I have to come up with a function with the criteria...
    D2>5
    G2= "B" or "C" or "D"
    E2= "marketing" or "finance"

    and then if those are true then C2* $Q$23 otherwise 0 is left in the cell.

  7. Debi Moore says:

    Hi
    Im using the following formula but it doesnt seem to be working

    =IF(OR(J1080:J20001="AUD","2021","2020","2019","2018","2017","2016"),'Economic Assumptions - Forex'!$M$9*K1080)=(OR(J1080:J20001="ZAR","2021","2020","2019","2018","2017","2016"),'Economic Assumptions - Forex'!$M$16*K1080)

    Please can you tell me what is wrong

    • Hello!
      I can’t test your formula as it contains unique references to your data. I do not have this data.
      However, the condition

      (J1080:J20001=”AUD”,”2021″,”2020″,”2019″,”2018″,”2017″,”2016″)

      is incorrect. Can only be used

      (J1080:J20001=”AUD”,J1080:J20001=”2021″, J1080:J20001=”2020″, J1080:J20001=”2019″, J1080:J20001=”2018″, J1080:J20001=”2017″,J1080:J20001=”2016″)

      I hope it’ll be helpful.

  8. Bob McIsaac says:

    I am getting the error message too mant arguements. Is there a way to have more than 2 options in an IF statement?

    =IF(I3="USD",$B$1*G3,IF(I3="GBP",$D$1*G3),IF(I3="CAD",$F$1*G3),0)

  9. al says:

    Can I convert 1.0 into 50 then 5.0 into 0?

  10. al says:

    Lets say
    I have 1.0 -5.0 then I wan between 50 - 0 so the value of 1.0 is 50 then if it 1.1 that's 49 how would I convrt 2.8 into its specific range

  11. Lindsay says:

    Hi! I am trying to have a cell return a value based on whether other values in the same row are greater than zero. To give more detail, the data is tracking steps in a hiring process, each column is a step in the process and the users will enter the date when that step is completed. I’d like to have an additional column that will say what step in the process that candidate is currently in. In other words, if for candidate A the most recent date entered is under the “interview complete” column, how do I make another column that will return “interview complete” as a value for candidate A?

  12. Brian says:

    I need all 3 of these variables to play nice together in one formula and I've been trying for 3 days to get it to work.
    HELP is greatly appreciated so that my brain can stop hurting.

    Cell A3 will always be either "D, "N" or "U"
    Cell E3 will always be a different value

    =if(and(A3="D",E3>2000),E3*0.25,"500")
    =if(and(A3="U",E3>900),E3*0.25,"300")
    =if(and(A3="N",E3>800),E3*0.25,"200")

    Thanks in advance

  13. Erin says:

    I am wondering if the formula has to include the absolute value, or if it can be a range. For example: I am trying to use the formula if the value is between 5.8-6.1 it will read as "Good". Is this possible to achieve, or can it only ever be = to one absolute value? This is the formula I have tried to do this: =If(C:C>=6.2,"Excellent",if(C:C=5.8-6.1,"Good",if(C:C=5.1-5.7,"Fair","Poor")

  14. Abhay says:

    Is there a way to include multiple AND statements in the IF formula? I am trying to populate response in Col A based on amounts in Col B and Col C.

    - If Col B and Col C are both less than 0, then response 'Loss'
    - If Col B and Col C are both greater than 0, then response 'Income'
    - If Col B less than 0 and Col C greater than 0, then response 'Loss / Income'
    - If Col B greater than 0 and Col C less than 0, then response 'Income / Loss'

    Currently excel is allowing only two conditions. When I add the third it says "You have entered too many arguments for this function".

    This works =IF(AND(B1<0,C10,C1>0),"Income"))

    This gives error message =IF(AND(B1<0,C10,C1>0),"Income"),IF(AND(B10),"Loss / Income"),IF(AND(B1>0,C1<0),"Income / Loss"))

    Thanks!

  15. Nael says:

    Hello

    I'm trying to combine a IF and SEARCH function in a formula where if it finds in S1 "WSPD" If true "WSPD" if false Search in S1 "WSTM" if True "WSTM" , if false Search "WSAC" in S1 if true "WSAC" if False Search in S1 for "WSAD" if true "WSAD" .... If any of does not contain WSPD or WSTM or WSAC or WSAD.... then "WSSC"

    I've put this formula
    =IF(SEARCH("WSPD",S4),"WSPD",IF(SEARCH("WSTM",S4),"WSTM",IF(SEARCH("WSAC",S4),"WSAC",IF(SEARCH("WSAD",S4),"WSAD",""))))

    It work to detect WSPD, but doesn't work for all other condition it just puts #VALUE

    Thanks for your help to find where I did wrong

  16. Jacob says:

    If the decimal number is lower than .5 then round down
    If the decimal number is higher than .5 then round UP
    if the decimal number is equal to 0.5 & if the number is odd then ROUND the int number to same odd number only
    If the decimal number is equal to 0.5 & if the number is even ,then round UP the int number to nearest odd number

  17. Jyoti Otageri says:

    Thank you so much, Alexander, for such lucid explanation of these really useful Excel functions. All of these were a great help!

  18. Theo Pretorius says:

    I have a sheet with 2 tabs. in the first sheet i have 4 different scores. 1, 0,5, 0 and blank. In the next tab I need a formula that return 1 and blank as 0 and the o and 0,5 as 1.

    How do I do the formula

  19. J Golden says:

    I am trying to create a formula that allows a name (that is typed in cell A) to input when a value (that is typed in cell C) =<192

  20. Naveen says:

    6% >= Breach > 5% 3% of breached orders
    8% >= Breach > 6% 5% of breached orders
    Breach > 8% 8% of breached orders

    I need formula

    • Naveen says:

      6% >= Breach > 5% 3% of breached orders
      8% >= Breach > 6% 5% of breached orders
      Breach > 8% 8% of breached orders

      I need in between formula

  21. Naveen says:

    If between AH5 cell is 0% TO 5% Results will be 0%
    If between AH5 cell 5% TO 6% Results will be 3%
    If between AH5 cell 6% TO 8% Results will be 5%
    If More than AH5 cell 8% percent Results will be 8%

    Please help me on this earliest

  22. Naveen says:

    Sir, please help me

  23. Naveen says:

    Guy, please let me if know the answer

  24. Lynn says:

    I am looking for the correct If statement:

    If C112%, 0%
    If C1>6% and <12%, C1/12%

    So the answer should return 100%,0%, or divide the %/12%

  25. Conrad says:

    Hi!
    I have cells I want to fill through conditional formatting depending on the following:
    1. If the schedule is MWF or TTS (found in column AH)
    2. The day of the week (found in row 2)

    I will have 2 formulas for conditional formatting: one for MWF, and the other for TTS.

    The cells that need filling are in C3 through AG30 (for a 31-day month).

    I tried using the formula (absolute reference excluded): =IF(AND(AH3="MWF",OR(C2="Mon",C2="Wed",C2="Fri"))), but it doesn't seem to work.

    Is there a way to use one formula for both MWF and TTS conditions?

    What can you advise? Thank you very much!

    P.S.
    If the cell is filled with some values, they should change colors, but I already have a separate conditional formatting formula for this.

    • Hi,
      If I understand your task correctly, the following formula should work for you:

      =(AND($AH3="MWF",OR(C$2="Mon",C$2="Wed",C$2="Fri")))

      Please check out the following article on our blog, it’ll be sure to help you with your task: Relative and absolute cell references in Excel conditional formatting rules
      I hope I answered your question.

      • Conrad says:

        Hi!

        Thank you for the prompt response. This works great!

        At the moment, I have 2 separate entries in the conditional formatting for MWF and TTS. Is there a way to combine both?

        Also, it works only if the entry in C$2 (and the rest of the cells in row 2) is actually "Mon", "Wed", or "Fri". if cell C2 has the formula =B$2+1 (and the rest of the cells in row 2 have a similar recursive formula), it does not work. The entries in this row are custom-formatted as "ddd" (to return 3-character days, i.e. Mon, Tue, Wed, etc.

        The formula in B2 is = A1, with A1 the first day of the month with the format mm/dd/yyyy.

        My current workaround is manually setting C2 to I2 as Mon, Tue, Wed, etc. with J2=C2, K2=D2 up to AG2=Z2, but I would like to automate this step as well so that the entire sheet is good to go when I change the entry in A1.

        I will need to research this further, but any help would be much appreciated.

        Thanks again!

        • Hi,
          The formula I sent to you was created based on the description you provided in your first request. However, as far as I can see from your second comment, your task is now different from the original one.
          Add to the OR formula the days of the week that you want. You have a sample.

          =IF(AND(OR(AH3="MWF",AH3="TTS"),OR(C2="Mon",C2="Wed",C2="Fri", C2=....,C2=....)))

  26. Vishkh Kumar says:

    Please Help I want formula for following - If cell Value of A1 is lesser than or equal 1300 then multiply by 14 if great than 1300 then first 1300 is multiply by 14 and remaining value is multiply by 11
    (result shows in A2)

    Ex:- if A1 value is 1200 then in A2 cell result is 1200*14
    if A1 Value is 1310 then in A2 cell result is 1300*14 & 10*11 = Total should be 18310 (18200+110=18310)

  27. Wati says:

    Hi, I want to input a date range for a cell for dates starting 1 April 2020 and ending 1 December 2020 and any corresponding values will give a certain point in another cell. Example:
    =if(AB149>=Date(2020,4,1),AB149<Date(2020,12,2),IFS(AC149=“GOLD”,3,AC149=“SILVER”,2,AC149=“PASS”,1,AC149=“NOT TAKEN”,-3))

    Can’t seem to get it right. Help please

  28. Wati says:

    Trying to input 2 logical conditions with different outcomes in one column.

  29. Lauren says:

    I have a list on a tab called data which has the following:
    Employee ID in cell A2, A3 ect
    Start date in cell B2, B3 ect
    End date in cell C2, C3 ect
    Leave code in cell D2, D3 ect

    Then I have a monthly calander on a tab called calander which has the following:
    Employee ID in cell A3, A4 ect
    The date in cell E2, F2 ect (i.e 1 Feb, 2 Feb)

    I want to insert a formal into the calander tab in say cell E3 which does the following: if the members employee number in A3 appears anywhere on the list on the data tab and the date in E2 falls between the dates on the date tab it returns the leave type for that date range. If that employee doesnt have a leave type in for that date then I want it to return a blank value

    Any help would be appreciated

    Thanks Lauren

  30. Rajkumar says:

    I am trying to write an excel formula which can be dragged across a row of cells to give the number of days in each month between two specified dates.
    A B C D E F

    1 | START DATE | END DATE | Jan | Feb | Mar | Apr ...etc |Location
    ---------------------------------------------------------
    2 | 01/26/20 | 10/30/20 | 0 | 19 | 15 | 0 |Mexico
    3 | 07/15/20 | 12/03/20 | 0 | 19 | 15 | 0 |United States

    Also, i have location specific holiday list to be excluded in this calculation. Now i am using the below formula to drive the days. But i can't change the holiday list based on Location column. I am expecting the holiday list to be chosen based on the value in the location column.

    =MAX(0,NETWORKDAYS(MAX(D$5,$B6),MIN(DATE(YEAR(D$5),MONTH(D$5)+1,0),$C6),$T$1:$T$20))

    Holiday List seems to be as below.
    United States Mexico
    1/1/2021 7/5/2021
    2/15/2021 9/6/2021
    5/31/2021 11/11/2021

    • Hello!
      You can use IF function:

      =IF(F5="Mexico",MAX(0,NETWORKDAYS(MAX(D$5,$B6),MIN(DATE(YEAR(D$5),MONTH(D$5)+1,0),$C6),$T$1:$T$20)),MAX(0,NETWORKDAYS(MAX(D$5,$B6),MIN(DATE(YEAR(D$5),MONTH(D$5)+1,0),$C6),$S$1:$S$20)))

      I hope this will help, otherwise please do not hesitate to contact me anytime.

      • SRK says:

        @Alex, thanks for your response. this is really helps. But In my case, i have a holiday list for nearly 20 regions. It's quite complicate to write if condition. Is there alternatives to perform this action?

        • Hello!
          You can use a named range in your formula.
          Create from $T$1:$T$20 named range "Mexico". Create from $S$1:$S$20 named range "United States".
          Please try the following formula:

          =MAX(0,NETWORKDAYS(MAX(D$5,$B6),MIN(DATE(YEAR(D$5),MONTH(D$5)+1,0),$C6),INDIRECT(F5)))

          If F5 contains "Mexico", then the formula INDIRECT(F5) will substitute the range $T$1:$T$20.
          I hope I answered your question. If something is still unclear, please feel free to ask.

  31. NAGARAJ says:

    2.8
    3.1
    5.0
    5.8
    5.0
    2.0
    2.8
    3.1

    HI SIR HOE CAN I CALCULATE % OF 5.0 DATA IN COLOUM

  32. alex says:

    What if i have 2 worksheets ( A and B). Worksheet A has a lot of data with various columns but in column A there are unique codes. Worksheet B has a few items all taken from worksheet A. Worksheet B also has the unique codes in column A (the same codes as worksheet A). i want to do a statement where it shows the following: if the unique code in worksheet B is he same as worksheet A and if column O in worksheet A has a date in it on the same row as the specified unique code then say YES in column H on worksheet B, if it does not have a date in it then say NO.

  33. Enerio says:

    Good day
    The second cell as my reference cell to my third cell has already formula, the formula is =IFERROR(C14/$C$13,0)*100 and displays nothing. The formula of the third cell is =IF(OR(D14=""),"",IF(D14>83.99,"O",IF(D14>75.99,"VS",IF(D14>67.99,"S",IF(D14>59.99,"FS",IF(D14<=59.99,"DNME","")))))) , but still the DNME will display. I want it to display nothing if the cell has no entry

    Please help me.. Thank you

  34. BC says:

    Can i do a formula for this?
    Tally all the dollar amount in column O lines 2 through 50
    But Only if there is a Y (for yes) in column V on each line
    If there is a N (for no) in column V its not included in the grand total

  35. Siddharth Mehta says:

    I have situation in which. If Requirement is greater than a Packaging standard then it should return value as per PAckaging standard. Ex - if requirement is 19 Kg and Packaging standard is of 6Kg then return value should be 24 KG.

    Another Example - If Requirement is of 17 Kg & Packaging standard is of 4 KG then return value should be 20 KG.

    Plz help me to apply this formula

  36. N G says:

    Trying to do the following:

    If text in A1:A30 = "Apples" then take number in B1:B30 and divide by 2. below is what i am trying to make it look like. Probably pretty easy for some but i am a rookie

    column A Column B Column C
    Apples 5000 2500

  37. Danijel Carev says:

    =IF(E2>=70, "Excellent", IF(E2>=60, "Good", IF(E2>40, "Satisfactory", "Poor ")))

    This formula doesn't work as is stated. How to make it work if you have logic text and column true and false. For example:
    Logic: E2>=70
    True: "Excellent"
    False: "Poor"

    How to insert other variables to work?

  38. MT says:

    I created the following formula based on the tutorial above. While the formula appears to work, I am unable to sum the results. I wasn't able to fix this by changing the formatting - it's already set to numbers. Any idea why this isn't working?

    =IF(A1>=30, "1.0", IF(A1>=10, ".5", IF(A1= 10-29, result should be .5
    A1>= 30, result should be 1.0

    Once I get the result, I then need to be able to sum the column for all values.

    • MT says:

      I created the following formula based on the tutorial above. While the formula appears to work, I am unable to sum the results. I wasn't able to fix this by changing the formatting - it's already set to numbers. Any idea why this isn't working?

      =IF(A1>=30, "1.0", IF(A1>=10, ".5", IF(A1<10, "0")))

      A1= 30, result should be 1.0

      Once I get the result, I then need to be able to sum the column for all values.

      I tried to submit this once already, but when it posted the details jumbled together - trying again.

    • Hello!
      To perform calculations on the results of your formula, it must return a number, not text.

      =IF(A1 > = 30, 1, IF(A1 > = 10, 0.5, IF(A1<10, 0)))

      I hope it’ll be helpful.

  39. Slim says:

    Hello everyone,

    Could you please check my formula?

    =IF(F2>=5000 & G2>=10%,"5%",IF(F2>=5000 & G2<10%,"3%",IF(F2<5000 & G2<10%,"10%",IF(F2=10%,"4%"))))

    So what I am trying to do is basically puting 2 conditions for 1 result. I will call the ensemble of these 2 conditions "Super condition", which in this case are 4 "super conditions".

    After including the formula, it gives me only one result, which is 5% no matter how much I change the values in the super condition.

    Can any one support regarding this matter, it would be most helpful!

    With my best regards,

  40. Jake Murphy says:

    Hello all,
    I have the current formula
    =IF(AND(I32>=$O$32,ABS(J32)= 1 hour and cell J32 <=.125 inches than I get a passing result. I am trying to add another condition onto this formula in that if cell J32<= .002 at any time I would also get a passing result. Any help would be greatly appreciated

    • Hello!
      If I got you right:

      =IF(AND(I32>=$O$32,ABS(J32)= 1,J32 < = 0.125,J32 < = 0.002),TRUE,FALSE)

      I don’t think this formula will work as the conditions ABS(J32)= 1,J32 < = 0.125,J32 < = 0.002 contradict each other. They cannot be executed at the same time.

      • Jake Murphy says:

        Cheers! I did have the incorrect formula written in my first comment. The correct formula is:
        =IF(AND(I32>=$O$32,ABS(J32)<=0.125),"Pass", "Fail")
        From here I was looking to add another condition onto this formula in that if cell J32<= .002 at any time I would also get a passing result. Apologies for the typo in the first question. I will see if I can implement your reply but more help in the matter would be fantastic.

  41. Mehedi says:

    Hi,
    Thank for such a great post!! and quick response for other!!

    Can you please help me!!
    My Logics are: 0+0=A, 0+1=B, 1+0=C, 1+1=D.

    I Tried with this, =IF(AND(I2="",J2=""),"A",IF(AND(I2="",J2=""),"B",IF(AND(I2="",J2=""),"C","D")))
    But this shows only A or D !!

    Thanks in advance.

    **Please ignore my previous post.

  42. Mazen says:

    I have a number that i want to find if it is available in a table of ranges then give me range index of the number
    ex:
    if i have a number 76 i want a formula to check number 76 in the below table and brings me the index =2
    if i have a number 211 i want a formula to check number 211 in the below table and brings me the index =4
    table of ranges
    1 1 to 69
    2 70 to 138
    3 139 to 207
    4 208 to 276
    5 2277 to 345

Post a comment



Thank you for your comment! When posting a question, please be very clear and concise. This will help us provide a quick and relevant solution to your query. We cannot guarantee that we will answer every question, but we'll do our best :)