Excel IF statement with multiple conditions

The tutorial shows how to create multiple IF statements in Excel with AND as well as OR logic. Also, you will learn how to use IF together with other Excel functions.

In the first part of our Excel IF tutorial, we looked at how to construct a simple IF statement with one condition for text, numbers, dates, blanks and non-blanks. For powerful data analysis, however, you may often need to evaluate multiple conditions at a time. The below formula examples will show you the most effective ways to do this.

How to use IF function with multiple conditions

In essence, there are two types of the IF formula with multiple criteria based on the AND / OR logic. Consequently, in the logical test of your IF formula, you should use one of these functions:

  • AND function - returns TRUE if all the conditions are met; FALSE otherwise.
  • OR function - returns TRUE if any single condition is met; FALSE otherwise.

To better illustrate the point, let's investigate some real-life formulas examples.

Excel IF statement with multiple conditions (AND logic)

The generic formula of Excel IF with two or more conditions is this:

IF(AND(condition1, condition2, …), value_if_true, value_if_false)

Translated into a human language, the formula says: If condition 1 is true AND condition 2 is true, return value_if_true; else return value_if_false.

Suppose you have a table listing the scores of two tests in columns B and C. To pass the final exam, a student must have both scores greater than 50.

For the logical test, you use the following AND statement: AND(B2>50, C2>50)

If both conditions are true, the formula will return "Pass"; if any condition is false - "Fail".

=IF(AND(B2>50, B2>50), "Pass", "Fail")

Easy, isn't it? The screenshot below proves that our Excel IF /AND formula works right: Excel IF statement with multiple AND conditions

In a similar manner, you can use the Excel IF function with multiple text conditions.

For instance, to output "Good" if both B2 and C2 are greater than 50, "Bad" otherwise, the formula is:

=IF(AND(B2="pass", C2="pass"), "Good!", "Bad") Excel IF function with multiple text conditions

Important note! The AND function checks all the conditions, even if the already tested one(s) evaluated 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 statement may result in an error because of this specificity. For example, the below formula would return #DIV/0! ("divide by zero" error) 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")

For more information, please see IF AND formula in Excel.

Excel IF function with multiple conditions (OR logic)

To do one thing if any condition is met, otherwise do something else, use this combination of the IF and OR functions:

IF(OR(condition1, condition2, …), value_if_true, value_if_false)

The difference from the IF / AND formula discussed above is that Excel returns TRUE if any of the specified conditions is true.

So, if in the previous formula, we use OR instead of AND:

=IF(OR(B2>50, B2>50), "Pass", "Fail")

Then anyone who has more than 50 points in either exam will get "Pass" in column D. With such conditions, our students have a better chance to pass the final exam (Yvette being particularly unlucky failing by just 1 point :) Excel IF function with multiple OR conditions

Tip. In case you are creating a multiple IF statement with text and testing a value in one cell with the OR logic (i.e. a cell can be "this" or "that"), then you can build a more compact formula using an array constant.

For example, to mark a sale as "closed" if cell B2 is either "delivered" or "paid", the formula is:

=IF(OR(B2={"delivered", "paid"}), "Closed", "")

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

IF with multiple AND & OR statements

If your task requires evaluating several sets of multiple conditions, you will have to utilize both AND & OR functions at a time.

In our sample table, suppose you have the following criteria for checking the exam results:

  • Condition 1: exam1>50 and exam2>50
  • Condition 2: exam1>40 and exam2>60

If either of the conditions is met, the final exam is deemed passed.

At first sight, the formula seems a little tricky, but in fact it is not! You just express each of the above conditions as an AND statement and nest them in the OR function (since it's not necessary to meet both conditions, either will suffice):

OR(AND(B2>50, C2>50), AND(B2>40, C2>60)

Then, use the OR function for the logical test of IF and supply the desired value_if_true and value_if_false values. As the result, you get the following IF formula with multiple AND / OR conditions:

=IF(OR(AND(B2>50, C2>50), AND(B2>40, C2>60), "Pass", "Fail")

The screenshot below indicates that we've done the formula right: IF with multiple AND & OR statements

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

  • In Excel 2007 and higher, you have no more than 255 arguments, and the total length of the IF formula does not exceed 8,192 characters.
  • In Excel 2003 and lower, there are no more than 30 arguments, and the total length of your IF formula does not exceed 1,024 characters.

Nested IF statement to check multiple logical tests

If you want to evaluate multiple logical tests within a single formula, then you can nest several functions one into another. Such functions are called nested IF functions. They prove particularly useful when you wish to return different values depending on the logical tests' results.

Here's a typical example: suppose you want to qualify the students' achievements as "Good", "Satisfactory" and "Poor" based on the following scores:

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

Before writing a formula, consider the order of functions you are going to nest. Excel will evaluate the logical tests in the order they appear in the formula. Once a condition evaluates to TRUE, the subsequent conditions are not tested, meaning the formula stops after the first TRUE result.

In our case, the functions are arranged from largest to smallest:

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

Naturally, you can nest more functions if needed (up to 64 in modern versions). Nested IF statement in Excel

For more information, please see How to use multiple nested IF statements in Excel.

Excel IF array formula with multiple conditions

Another way to get an Excel IF to test multiple conditions is by using an array formula.

To evaluate conditions with the AND logic, use the asterisk:

IF(condition1) * (condition2) * …, value_if_true, value_if_false)

To test conditions with the OR logic, use the plus sign:

IF(condition1) + (condition2) + …, value_if_true, value_if_false)

To complete an array formula correctly, press the Ctrl + Shift + Enter keys together. In Excel 365 and Excel 2021, this also works as a regular formula due to support for dynamic arrays.

For example, to get "Pass" if both B2 and C2 are greater than 50, the formula is:

=IF((B2>50) * (C2>50), "Pass", "Fail") IF array formula with multiple AND conditions

In my Excel 365, a normal formula works just fine (as you can see in the screenshots above). In Excel 2019 and lower, remember to make it an array formula by using the Ctrl + Shift + Enter shortcut.

To evaluate multiple conditions with the OR logic, the formula is:

=IF((B2>50) + (C2>50), "Pass", "Fail") IF array formula with multiple OR conditions

Using IF together with other functions

This section explains how to use IF in combination with other Excel functions and what benefits this gives to you.

Example 1. If #N/A error in VLOOKUP

When VLOOKUP or other lookup function cannot find something, it returns a #N/A error. To make your tables look nicer, you can return zero, blank, or specific text if #N/A. For this, use this generic formula:

IF(ISNA(VLOOKUP(…)), value_if_na, VLOOKUP(…))

For example:

If #N/A return 0:

If the lookup value in E1 is not found, the formula returns zero.

=IF(ISNA(VLOOKUP(E1, A2:B10, 2,FALSE )), 0, VLOOKUP(E1, A2:B10, 2, FALSE))

If #N/A return blank:

If the lookup value is not found, the formula returns nothing (an empty string).

=IF(ISNA(VLOOKUP(E1, A2:B10, 2,FALSE )), "", VLOOKUP(E1, A2:B10, 2, FALSE))

If #N/A return certain text:

If the lookup value is not found, the formula returns specific text.

=IF(ISNA(VLOOKUP(E1, A2:B10, 2,FALSE )), "Not found", VLOOKUP(E1, A2:B10, 2, FALSE)) If #N/A error in VLOOKUP

For more formula examples, please see VLOOKUP with IF statement in Excel.

Example 2. IF with SUM, AVERAGE, MIN and MAX functions

To sum cell values based on certain criteria, Excel provides the SUMIF and SUMIFS functions.

In some situations, your business logic may require including the SUM function in the logical test of IF. For example, to return different text labels depending on the sum of the values in B2 and C2, the formula is:

=IF(SUM(B2:C2)>130, "Good", IF(SUM(B2:C2)>110, "Satisfactory", "Poor"))

If the sum is greater than 130, the result is "good"; if greater than 110 – "satisfactory', if 110 or lower – "poor". Using the IF function with SUM

In a similar fashion, you can embed the AVERAGE function in the logical test of IF and return different labels based on the average score:

=IF(AVERAGE(B2:C2)>65, "Good", IF(AVERAGE(B2:C2)>55, "Satisfactory", "Poor"))

Assuming the total score is in column D, you can identify the highest and lowest values with the help of the MAX and MIN functions:

=IF(D2=MAX($D$2:$D$10), "Best result", "")

=IF(D2=MAX($D$2:$D$10), "Best result", "")

To have both labels in one column, nest the above functions one into another:

=IF(D2=MAX($D$2:$D$10), "Best result", IF(D2=MIN($D$2:$D$10), "Worst result", "")) Using IF together with the MIN and MAX functions

Likewise, you can use IF together with your custom functions. For example, you can combine it with GetCellColor or GetCellFontColor to return different results based on a cell color.

In addition, Excel provides a number of functions to calculate data based on conditions. For detailed formula examples, please check out the following tutorials:

  • COUNTIF - count cells that meet a condition
  • COUNTIFS - count cells with multiple criteria
  • SUMIF - conditionally sum cells
  • SUMIFS - sum cells with multiple criteria

Example 3. IF with ISNUMBER, ISTEXT and ISBLANK

To identify text, numbers and blank cells, Microsoft Excel provides special functions such as ISTEXT, ISNUMBER and ISBLANK. By placing them in the logical tests of three nested IF statements, you can identify all different data types in one go:

=IF(ISTEXT(A2), "Text", IF(ISNUMBER(A2), "Number", IF(ISBLANK(A2), "Blank", ""))) IF with ISNUMBER, ISTEXT and ISBLANK

Example 4. IF and CONCATENATE

To output the result of IF and some text into one cell, use the CONCATENATE or CONCAT (in Excel 2016 - 365) and IF functions together. For example:

=CONCATENATE("You performed ", IF(B1>100,"fantastic!", IF(B1>50, "well", "poor")))

=CONCAT("You performed ", IF(B1>100,"fantastic!", IF(B1>50, "well", "poor")))

Looking at the screenshot below, you'll hardly need any explanation of what the formula does: Using IF and CONCATENATE

IF ISERROR / ISNA formula in Excel

The modern versions of Excel have special functions to trap errors and replace them with another calculation or predefined value - IFERROR (in Excel 2007 and later) and IFNA (in Excel 2013 and later). 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.

For example, to replace the "divide by zero" error (#DIV/0!) with your custom text, you can use the following formula:

=IF(ISERROR(A2/B2), "N/A", A2/B2) Using IF together with ISERROR

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!

Practice workbook for download

Excel IF multiple criteria - examples (.xlsx file)

4538 comments

  1. Hello, would you be able to help me with this.

    For example I have your conditions (which consist of two different statements) and 4 different answers for each.

    For example:

    I have
    A1=no, B1=short
    A1=no, B1=long
    A1=yes, B1=short
    A1=yes, B1=short

    Both conditions must be met:

    If No/short - formula (E1-D1)*C1
    If no/long - formula (D1-E1)*C1
    If yes/short (D1-G1)*C1
    if yes/long (G1-D1)*C1

    All this needs to go to one cell, because there are 4 outcomes possible. How it needs to be written in one cell?

    I am confused.

    • correction

      A1=no, B1=short
      A1=no, B1=long
      A1=yes, B1=short
      A1=yes, B1=long

    • Hello!
      If I got you right, the formula below will help you with your task:

      =CHOOSE((A1="no")*1+(A1="yes")*2+(B1="short")*3+(B1="long")*5, "","","",(E1-D1)*C1,(D1-G1)*C1,(D1-E1)*C1,(G1-D1)*C1)

      You can learn more about CHOOSE function in Excel in this article on our blog.
      I hope I answered your question.

  2. resending
    Hi, please help to correct my formula: =IF(A2-B2)>=500, "SAFE", IF(A2-B2)>=400,"AVERAGE", IF(A2-B2)500 - SAFE
    (A2-B2)>400 - AVERAGE STOCKS
    (A2-B2)<400 - LOW STOCKS

    Thank you!

    • Hi!
      Please re-read the article above, it covers your case completely.
      Your conditions contradict each other:
      IF(A2-B2)>=400,”AVERAGE”
      (A2-B2)>400 – AVERAGE STOCKS

  3. Hello,

    Looking at the examples of IF AND and OR on your page I'm trying to create a formula that displays whether a call was made during an evening and weekend call plan.

    Evenings would be 7pm-7am
    Weekends would be 7pm Friday - 7am Monday

    If the call was made during Evenings/Weekends I'd like to display Yes in column E otherwise display No.
    Column D is what I would expect to see.

    I've created the following two parts of the formula which work on their own but I don't know how to create 1 formula that includes all the rules for evening and weekend calls .
    =IF(AND(C2"Sat", C2"Sun"),"No", "Yes")
    =IF(AND(B2>=TIMEVALUE("07:00:00"),B2<=TIMEVALUE("19:00:00")), "No", "Yes")

    I've manually entered values into the expected output column. Apologies if the column headings don't line up.

    A B C D E
    Date Time Weekday Expected output Covered by evening and weekend call plan
    02/08/2021 14:11:11 Mon No
    31/07/2021 12:37:10 Sat Yes
    31/07/2021 16:52:23 Sat Yes
    30/07/2021 21:11:19 Sun Yes
    29/07/2021 20:25:36 Sun Yes
    28/07/2021 20:30:21 Wed Yes

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

      =IF(OR(WEEKDAY(A1,2)+A1-INT(A1)<(1+TIMEVALUE("7:00:00")), WEEKDAY(A1,2)+A1-INT(A1)>(5+TIMEVALUE("19:00:00"))),"Yes","No")

      Hope this is what you need.

      • Hi Alexander,

        Thanks for taking a look at this and for your suggestion, unfortunately it didn't give me the result I was looking for.

        The conditions are a Yes if either Weekday=Sat or Sun, OR time of day for remaining days is =19:00

        Date Time Weekday Expected_output Alexander_solution_evening_and_weekend_call
        02/08/2021 14:11:11 Mon No Yes
        31/07/2021 12:37:10 Sat Yes Yes
        31/07/2021 16:52:23 Sat Yes Yes
        30/07/2021 21:11:19 Sun Yes No
        29/07/2021 20:25:36 Sun Yes No
        28/07/2021 20:30:21 Wed Yes No

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

          =IF(OR(A1-INT(A1)<=TIMEVALUE("7:00:00"), A1-INT(A1)>=TIMEVALUE("19:00:00"),WEEKDAY(A1,2) > 5),"Yes","No")

  4. Hello,

    If D2 cell contains value which start from word "Root" and here i cannot use entire sentence of "Root " so
    if i have to use it in multiple if conditions how can use that?

    =IF(AND(A2)="Y", (C2)="n/a", (D2)="???","Met","Miss")

  5. If in a column range is Safdar and in next column his number is 6 which formula can tell me that if in that range Safdar exist then bring his number 6

  6. Hello! I am trying to solve for the correct way to use IF and VLOOKUP when:

    IF H5 refers to "Basic Monthly", "Plus Monthly", "Elite Monthly" (I'd like these to just result in "Monthly" for the VLOOKUP. Same format exits for Annual portion of the formula.

    VLOOKUP Table Example (monthly rate table):
    $1.00 $5,000.00 10%
    $5,001.00 $10,000.00 15%
    $10,001.00 $99,999.00 20%

    I've tried variations of the following:
    '=
    IF($H5="Monthly",
    VLOOKUP($L5,'Direct Sales Commission Tables'!$A$26:$C$28,3,TRUE),
    IF($H5="Annual",
    VLOOKUP($L5,'Direct Sales Commission Tables'!$E$26:$G$28,3,TRUE),
    IF($H5="NA",0)))

    Thank you for any guidance!

  7. Hello,

    I would like to create a formula for three test conditions with dates, but I'm having trouble with adding the dates. This is the formula I would like:

    If test priority is "High" (A1), add one week from initiated date (B1) to due date (C1)
    If test priority is "Medium" (A1), add two weeks from initiated date (B1) to due date (C1)
    If test priority is "Low" (A1), add three weeks from initiated date (B1) to due date (C1)

    Thank you!!

  8. Im trying to do a formula to calculate for me result if I multiply the rate with the consumption but based on different ranges or slabs each range with different rate;
    1) if equal or more than 2000kwh calculate for me: x*rate 1
    2)if more than 2000 but less than or equal 4000 : x*rate 2
    3) if more than 4000 : x*rate 3

  9. Hello,
    May i know how to combine below formula in 1 formula? Thank you very much!

    =IF(ISBLANK(J1793),"",IF(WORKDAY.INTL(J1793,-4,1,holiday!A:A),WORKDAY.INTL(J1793,-3,1,holiday!A:A)))
    =IF(ISBLANK(J1800),"",IF(OR(WEEKDAY(J1800,2)=6,WEEKDAY(J1800,2)=7),WORKDAY(J1800,-5,holiday!$A:$A),WORKDAY(J1800,-4,holiday!$A:$A)))
    =IF(ISBLANK(J1801),"",IF(OR(WEEKDAY(J1801,2)=6,WEEKDAY(J1801,2)=7),WORKDAY(J1801,-4,holiday!$A:$A),WORKDAY(J1801,-3,holiday!$A:$A)))

    • Hello!
      The terms in these formulas are not related to each other. All of them can be performed at the same time. If ISBLANK(J1793), ISBLANK(J800) and ISBLANK(J1801) return TRUE at the same time, which condition will you fulfill? Therefore, your desire cannot be fulfilled.

  10. Hi I'm having trouble writing a formula, where if there's a date entered in cell AG2 for the text "Closed" to be entered automatically, and the same for AD2 and E2, but with differing text. Otherwise to leave the cell empty.
    But I can't seem to get it to work, as it returns an empty cell, even though there's dates in these cells.
    However for some reason, if I take the asterisk out of the quotations it'll enter the text for the cell without anything in (which shows it does kind of work, just not the way I want it to). I'm probably doing something wrong here, could you have a look and adjust it if possible?

    =IF(AG2="*","Closed",IF(AD2="*","Awaiting Sign Off",IF(E2="*","Open","")))

    Thank you

    • Hello!
      Please try the following formula:

      =IF(AG2<>"","Closed",IF(AD2<>"","Awaiting Sign Off",IF(E2<>"","Open","")))

      I hope it’ll be helpful.

      • Works perfectly. Thank you for the fast response.

  11. Is it possible to create an IF formula that writes different results (separated with a comma) in the same cell? for example, let's say
    A2 = #10 031
    A4 = #15 213
    A1= 0
    A4= 0
    If A1 is equal to "1" do not write anything but if A1 is equal to "0" then result is equal to A2
    If A3 is equal to "1" do not write anything but if A1 is equal to "0" then result is equal to A4
    If.... continues

    then the formula should write in the same cell =
    #10 031, 15 213

    I don't know if I am making myself clear xD, any master out there who knows if its possible?

    • My bad
      A2 = #10 031
      A4 = #15 213
      A1= 0
      A3= 0

      • oh :c
        I will try to work around that,
        thanks a lot, you saved me a lot of time.

  12. I am looking to solve this formula - where X is a variable (% performance)
    IF(X80100150,550000)))))

    what am I doing wrong?

    • Sorry this was captured wrongly. Here are the conditions:

      % performance Award
      150% 550,000.00
      >100%80%<100% 250,000.00
      <80% -

  13. I need help to get an appropriate formula for my table.
    The table headers have A remark(Suppressed, Unsuppressed), B indicator(Routine, Targeted), C (Date of Result), and D (Next due date)
    I want the following to happen,
    1) If (A2) is Suppressed and (B2) is Routine, (D2) should add 11 months from (C2) date.
    2) If (A2) is Suppressed and (B2) is Targeted, (D2) should add 5months from (C2) date.
    3) if (A2) is suppressed and (B2) is either Routine or Targeted, (D2) should add 3months from (C2) date.

      • Thank you, Alexander. You are a genius. This is the modification I made from the formula you gave me
        =IF(A2="SUPPRESSED", IF(B2=TARGETED", DATE(YEAR(C2), MONTH(C2)+5,DAY(C2)), IF(L6="SUPPRESSED", IF(B2="ROUTINE", DATE(YEAR(C2), MONTH(C2)+11,DAY(C2))), C2))).
        It works. However, my No 3 condition should be (A2) is "unsuppressed" and (B2) routine or targeted.

  14. i want to fill cell variable values from 1 to 9 according to the many conditions
    i used this formula but not reflect result

  15. Hi Friends,

    pls can u help me to get the formula for example ive explained below

    if B2 cell value is greater than c2 cell value (good) or d2 cell value(very good) or e2 cell value (excellent)

    i want to get this good or very good or excellent comments in F2 cell

      • thx for ur reply, just chked it but my point is i want to take cell values dnt need have particular numbers,

        eg:

        B3 cell value is 50, D3 cell value is 51, E3 cell value is 60 and F3 cell value is 61

        =CHOOSE((B3>=D3) + (B3>=E3) + (E3>=F3), "GOOD", "VERYGOOD", "EXCELLENT")

        So how to use cell value instead of any number

        • Hello!
          I’m not sure I got you right since the description you provided is not entirely clear. However, it seems to me that the formula below will work for you:

          =CHOOSE((B3>=D3) + (B3>=E3) + (F3>=F3), "","GOOD", "VERYGOOD", "EXCELLENT")

          If this is not what you need, explain what kind of result you would like to get in your example.

  16. Am developing an incentive and the entry level is 91 scoring 8% and the maximum is 253 scoring 15%. If one scores below 91 thats a zero and if they score more than 253 they earn 15%. What is the formula that will calculate anything between 91 and 253?

  17. Hi Alexander,
    Requesting you to please help me find the formula for the situation that we discussed the other day.
    Thanks,
    Jasmeet Singh

  18. Can someone assist please?
    I have the following

    A1 = Yes
    B1 = a Date
    C1 = a string of 6 digit number with a letter

    I want D1 to have the Value "Fully Verified" if all three cells in the row are filled.
    If either B1 or C1 is blank, the return value in D1 to be "Not Verified"
    If both B1 and C1 are blank, the return value in D1 to be "Not Verified"

    What formula will suit this argument and how can that be arranged to give the desired return value?

    Thanks ...

  19. Hi,
    Please help me finding the following:
    cell A2 contain6/2/21 7:14 PM
    If the value for A2 is between 7:30 PM to 10:30 PM and the day of the week is Tuesday, then the value should be a text "ABCZYZ"

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

      =IF(AND(WEEKDAY(D1,2)=2,(D1-INT(D1)>19.5/24),(D1-INT(D1)<22.5/24)),"ABCZYZ","")

      You can learn more about WEEKDAY function in Excel in this article on our blog.

      • Hi Alexander,
        Thank you so much for the swift response.
        I need help with another formula. There are 2 sheets in excel:
        Sheet1 :
        Date start time End Time Analyst
        1/5/2021 7:30 13:30 ANALYST1
        1/5/2021 13:30 16:00 ANALYST2
        1/5/2021 16:00 18:30 ANALYST3
        1/5/2021 18:30 21:00 ANALYST4
        1/5/2021 21:00 0:00 ANALYST5
        1/5/2021 0:00 3:00 ANALYST6
        1/6/2021 7:30 13:30 ANALYST1
        1/6/2021 13:30 16:00 ANALYST2
        1/6/2021 16:00 18:30 ANALYST3
        1/6/2021 18:30 19:00 ANALYST4
        1/6/2021 21:00 0:00 ANALYST5
        1/6/2021 0:00 3:00 ANALYST6
        Sheet 2:
        1/5/21 5:32 AM
        1/5/21 3:39 PM
        1/5/21 3:45 PM
        1/5/21 7:05 PM
        1/5/21 8:51 PM
        1/5/21 10:47 PM
        1/5/21 12:57 AM
        1/6/21 5:05 PM
        1/6/21 7:53 PM
        1/6/21 9:13 PM
        1/6/21 11:50 PM
        1/6/21 5:53 PM
        1/6/21 11:36 PM
        1/6/21 6:11 PM
        1/6/21 6:15 PM
        1/6/21 7:03 PM
        1/6/21 7:03 PM
        1/6/21 7:03 PM
        1/6/21 7:03 PM

        I want a formula to find out the name of the analyst who is responsible as per sheet 2 data. For instance, 1/5/21 3:39 PM incident is for Analys2 or 1/6/21 9:13 PM should pull up Analyst 5. In other words, if the date in sheet 2 matches the date in sheet 1 then the time in sheet 2 for the same date should look up the value in start time and end time of sheet 1 and populate the value for the Analyst.

        Thanks,
        Jasmeet Singh

          • Hi Alexander,
            Thank you so much for sharing the formula.
            I have tried but it is not giving me value as N/A. Can you please share the complete formula.
            This would be of a great help as I have some deliverables and need this urgent. This will be of a great great help.

            Thanks,
            Jasmeet Singh

            • Hi Alexander,
              Apologies to pester you.

              To add to this, the Sheet 2 has 2 columns not 1:
              Column1 : Date
              Colum 2 : time

              Thanks,
              Jasmeet Singh

            • Hello!
              An NA error means that the required value was not found. The IFERROR function can be used.

              =IFERROR(INDEX(D1:D12,MATCH(1,(INT(F1)=A1:A12)*(F1>A1:A12+B1:B12)*(F1<A1:A12+C1:C12),0)),"")

              Please check out this article to learn how to use IFERROR in Excel.

              Also, note that the time interval is incorrect:
              1/5/2021 21:00 0:00
              00:00 is the beginning of the day. The interval from 21:00 to 00:00 is nonsensical. Use 21:00 23:59

              • Hi,
                I have put all the values given above in one sheet from column A2 to F12 and applied the above given formula in G2, however no result is displayed. The column F contains both date and time, such as 1/5/21 5:32 AM. Please see the formula below:

                =IFERROR(INDEX(D2:D12,MATCH(1,INT(K2)=A2:A12)*(K2>A2:A12+B2:B12)*(K2<A2:A12+C2:C12),0),"REVIEW")
                It only shows "REVIEW".

                Please help to fix this.

                Thanks,
                Jasmeet Singh

              • 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. Hence, the formula fails to work. I'm sorry for the wasted time. When I have more time, I will think of another formula.

  20. Hi,

    I want to ask I need to sum A2 + B2 and the total in column C2 and if the total C2 is more than 100 it will display the balance in column D2.

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 :)