Comments on: Excel IF statement with multiple conditions

For powerful data analysis, you may often need to build an Excel IF statement with multiple conditions or use IF together with other functions. This tutorial will show you the most effective ways to do this. Continue reading

Comments page 106. Total comments: 4575

  1. Hi I am trying to set a condition for a taxable item. Column D has my department number. I have 9 departments 3 of which are non-taxable is this the correct formula?
    =IF(D2="1", "NO", IF(D2="2", "yes", IF(D2="3", "yes", IF(D2="4", "yes", IF(D2="5", "yes", IF(D2="6", "no", IF(D2="7", "no", IF(D2="8", "no", IF(D2="9", "no")))))

  2. Can any one let me know the logical formula to create.

    If H1 has got number >=1000, f1 should show as "A", if H1 has got number >=500,<999, f1 should show as "B", if H1 has got number <499, f1 should show as "NA"

  3. Hi, I currently have two formulas that I need to make into one.
    If cell D4 is greater than cell F3 then do this =IF(E4=C4-2;4;IF(E4=C4-1;3;IF(E4=C4;2;IF(E4=C4+1;1;0))))
    But if cell D4 is less than cell F3 then do this =IF(E5=C5-2;5;IF(E5=C5-1;4;IF(E5=C5;3;IF(E5=C5+1;2;IF(E5=C5+2;1;0)))))

    can you possibly show me how to join these into one long formula

    thanks
    Gordon

  4. hi i need help with a formula, if cell 1a is from 0 - 500 * it by .2 if 1a is between 501-1000 then = 100 if 1a over 1001 * it by .15 , also I will need to * the answer by a %

    thanks

  5. Hi Friends

    Could you please help me to get the excel formula for the below mentioned calculation.

    If value of cell(say X)<10 then value is 5,if X in between 10 to 100 then value is 0.7%*X & minimum value 6,
    if X in between 100 to 200 then value is 0.6%*X & minimum value is 7 and maximum value is 9.

    Looking forward for your kind support & thank you in advance.

    Thanks & Reagrds
    Aman Kumar

  6. Hi Friends

    Could you please help me to get the excel formula for the below mentioned calculation.

    If value of cell(say X)<10 then value is 5,if X in between 10 to 100 then value is 0.7%*X & minimum value 6,
    if X in between 100 to 200 then value is 0.6%*X & minimum value is 7 and maximum value is 9.

    Looking forward for your kind support & thank you in advance.

    Thanks & Regards
    Aman Kumar

  7. Hi please help me. I've been cracking my head for almost a week now.I need a formula to sum up this

    If column is 1 then multiply with 0.65
    If column is 2 then multiply with 0.55
    If column is 3 then multiply with 0.45
    If column is 4 then multiply with 0.35

    1. =IF(A1=1,A1*0.65,IF(A1=2,A1*0.55,IF(A1=3,A1*0.45,A1*0.35)))

  8. Hi,
    I need your advice. I can't find a way to write a formula for multiple logic from 2 different cells.

    To determine "Moving" from one of the cell, let's say A1 is "Yes".
    To determine "Sales" from one of cell, B1 is any number more than "0".

    Here are the logic:
    1. With Moving & With Sales = Moving
    2. Without Moving & without Sales = Non-moving
    3. With Moving & Without Sales = Others
    4. Without Moving & With Sales = Others

    So, what should I put C1 for the formula.
    I tried combination of IF (AND & OR) but failed.

    =IF(AND(E2="Yes";G2>=1);"Moving";"")&IF(AND(E2="No";G2=0);"Non-moving";"")&IF(AND(E2="Yes";G2=0);"Others";"")&IF(AND(E2="No";G2=0);"Others";"")

    It ended up with 2 results in 1 cell. For example, Non-moving & Others.

    Please help.

    Thank you so much!

    1. I managed to solve it.

      =IF(AND(E17="Yes";G17>=1);"Moving";"")&IF(AND(E17="No";G17=0);"Non-moving";"")&IF(AND(E17="Yes";G17=0);"Others";"")&IF(AND(E17="No";G17>=1);"Others";"")

  9. Hi,
    I need your advice. I can't find a way to write a formula for multiple logic from 2 different cells.

    To determine "Moving" from one of the cell, let's say A1 is "Yes".
    To determine "Sales" from one of cell, B1 is any number more than "0".

    Here are the logic:
    1. With Moving & With Sales = Moving
    2. Without Moving & without Sales = Non-moving
    3. With Moving & Without Sales = Others
    4. Without Moving & With Sales = Others

    So, what should I put C1 for the formula.
    I tried combination of IF (AND & OR) but failed.

    Please help.

    Thank you so much!

  10. Hi there, I can't find a way to write a formula. I have the following list and I want in A6 write the number form B if A5 in the A list
    | A | B |
    1|aaa| 4 |
    2|bbb| 2 |
    3|ccc| 8 |

    If A5=aaa then write 4, If A5=bbb then write 2, If A5=ccc then write 8

    Thank you

  11. Hi there,
    I have a problem to be solved. like,
    Leave
    Taken CL SL PL CL2 SL2 PL2
    0 0.5 0.5 22
    10 0.5 0.5 3.5
    2 0.5 0.5 2
    0 0.5 0.5 6.5
    4 0.5 0.5 43.5
    i want to have a formula if cl2 leave taken than shud be = number(value)
    or if cl2=leave taken than shud be =0. can we do that. please advise.

  12. Hi I want to creates system that assigns roll numbers to my students.
    the conditions are:
    if 1-99 then it should display roll as SA followed by the number eg roll assignment should be SA1 for the 1st student, SA2 for 2nd student etc.
    For the next 100-999 then it should display roll as SB1 for the 100th student,SB2 for the 101st student.

    1. Hello Lavanya,

      If you have serial numbers from 1 to 999 in some column, say column A, you can use the following formula:

      =IF(A1>99, "SB"&A1-99, IF(A1>0, "SA"&A1, ""))

      Or, you can generate roll numbers based on the row numbers in a worksheet:

      =IF(ROW()>99, "SB"&ROW()-99, "SA"&ROW())

  13. in ecxellsheet 1 column of date,i want that date become red when diff between today date and that day is above 365 day...which formula i used???

  14. Hi,

    I need some help how to create a formula that combines 2 sheets in my work book.

    I need formula to do this: If "name" in under some specific "date" then I want the "value" that is in cell next to to the "name" and under that "date" to be transferred to a cell under the same "date" but in other sheet.

    Can this be done and if it can how?

    Very much appreciate any help you can provide on this matter.

    Thank you in advance.
    Sincerely yours,
    Eduard

  15. Hello Ms. Svetlana,

    I am using advance filters (and data range w/ drop down list) to filter data from a table with projects information, including "End Date" (of the project). The problem is, I have numbers (date) and sometimes text (e.x. "ongoing" project) in the cell, so the advance filter doesn´t work. I think I need a "If" statment that works with both numbers and text in the same cell.

    Thanks for your time!

  16. Hello,

    I want give range in if condition

    =IF(A2:A17=I2:I14,"Match","Not Match")

    i have a column whose name "A" and same as "I" i want to compare his value.

    i want to match entire "A" and "I" column's value.

    is it possible then please guide me....

  17. Hi, could you help to set up a formula for below question?
    Q: >=1000kg, 0.1/kg; >=2000kg,0.09/kg; >=3000kg,0.08kg, Min.100, Max.500.
    Thanks a lot.

  18. Hi
    I am trying to do a formula in excel which looks up a date from a cell in one sheet in to the equivalent cell in another sheet, however I have a couple scenarios that are a problem. I am looking up 2 columns both of which have dates in them, in the first column I need to look up F2 from one sheet and put it in to the other sheet in F2, however I have some blanks so I have used an ISBLANK formula without a problem =IF(ISBLANK('MAIN LIST 2'!F2)," ",('MAIN LIST 2'!F2)).
    I also have to look up G2 from one sheet to the other equivalent cell, however if there is a blank in cell G2, I need to use what is in F2 which I have used =IF('MAIN LIST 2'!G2,'MAIN LIST 2'!G2,'MAIN LIST 2'!F2), however this brings back 00/01/1900 in some cells where the cells in column F is blank. How do I return a blank in G2 if both F2 and G2 are both blank in the other sheet.
    Thanks

  19. Hai,

    Please help me to get a formula for my payroll calculation.Conditions are if an employee need to present for only 24 days in a month his salary will be the basic salary and if he comes more than the required days in a month ,ie, in this month more than 24 days his salary will be basic salary + basic salary/26*additional days present and if he is present for less than required days, no salary deducted for 2 grace days but if it is less than 22 days in this month his salary will be basic salary minus (basic salary/26*(22-number of attendance)

  20. Hi,

    could you tell me what is wrong with the formula below?

    it does not work for routine

    =IF(AND(H2="emergency",N2>TIME(3,0,0)),"Failed",IF(AND(H2="emergency",L2>TIME(0,20,0)),"Failed",IF(AND(H2="urgent",N2>TIME(24,0,0)),"Failed",IF(AND(H2="urgent",L2>TIME(4,0,0)),"Failed",IF(AND(H2="routine",N2>TIME(72,0,0)),"Failed",IF(AND(H2="routine",L2>TIME(24,0,0)),"Failed","Passed"))))))

  21. =IF(E6="S",IF(G4>=3,"PAID",IF(G4=0,"DUE","PART PAYMENT")))
    +
    IF(E6="F",IF(G4>=6,"PAID",IF(G4=0,"DUE","PART PAYMENT")))

    I want to merge this two formula

  22. Hi, i wish you could help me with this problem,
    Cell A is due date
    Cell B is invoice amount
    Cell C is Amount paid
    Cell D is Open Balance
    Cell E is status
    I would like to put formulae in cell E to have either paid,overdue or open.

  23. Hi, I am having problems trying to come up for a formula for the following:

    Amount Service Count
    1 0.00% 1
    1 100% 0
    2 50% 1
    4 50% 2

    So, If service is 0% the count should be the contents of amount, if 100% the count should be equal to zero but if the service is 50% it should be the 50% of the contents of the amount cell.

  24. Please help my on this formula
    I want every cell in the row more than 60 to give me the difference otherwise if it is 60 than give me a 0
    My formula looks like:
    =IF('TOTAL WEEK 1'!$D$4:$R$4>60;'TOTAL WEEK 1'!$D$4:$R$4-60;0)
    But if give me only a result if it is more in the first cell not in the following cells .
    Thank you in advance

  25. Hi there I cant work out how to do this function:

    If H39 is between 0 and 50000 * 0.1. if H39 is between 50000 and 100000 *0.085. if H39 is between 100000 and 500000 *0.06. if H39 is over 500000 *0.05

    are you able to help

  26. thanks

  27. Hello,

    Please help, I need formula for below condition:

    If 0-30 should show "C", if 31-60 should show "B", if 61 above should show "C".

    Thanks

    1. Hello!

      Here you go:

      =IF(AND(A1>=0,A1<31), "C", IF(A1<61,"B", "A"))

      Please note that your conditions have "C" for 0-30, and >61, which is obviously a misprint, so I used "A" for the latter.

  28. Pl send me formula for below criteria.

    New Hires
    Individuals, who join on or before the 10th of any month, will earn MTO credit for the period from the 1st to the 15th of the month and accrue such credit on the 16th of the month. Individuals, who join after the 10th of the month, will not earn any MTO credit on the 16th of the month.

    Individuals, who join on or before the 25th of any month, will earn MTO credit for the period from the 16th to the end of the month on the 1st of the following month. Individuals, who join after the 25th of the month, will not earn any MTO credits on the 1st of the following month.

    Separations
    Individuals, who leave the services of the company on or after the 10th of any month, will earn MTO credit for the period from the 1st to the 15th of such month. Individuals, who leave before the 10th of the month, will not earn any MTO credits for the period from the 1st to the 15th of such month.

    Individuals, who leave the services of the company on or after the 25th of any month, will earn MTO credit for the period from the 16th to the end of such month. Individuals, who leave before the 25th of the month, will not earn any MTO credits for the period from the 16th to the end of such month.

  29. =IF(B3>69,20(OR(B3>50403010<29,2))))))))). Not sure my formula showed up completely.

    1. Hello Barbara,

      It looks like the formula got posted all wrong, sorry for this. Can you please describe the conditions in words?

      For example:
      - If B3 is greater than 69, return 20
      - If B3 is greater than 50, then what? etc.

      1. If b3 is greater than 69, return 20
        If b3 is greater than 50, less than 68, return 15
        If be is greater than 40, less than 49, return 10
        If b is greater than 30, less than 48, return 5
        If b3 is less than 29, return 2

        I hope this one is more clear. Thank you Svetlana

        1. Hello Barbara,

          You can us the following nested If's:

          =IF(B3>69,20, IF(B3>=50,15, IF(B3>=40,10, IF(B3>=30,5,2))))

  30. =IF(B3>69,20,(OR(B3>50403010<29,2)))))))))

    This formula is supposed to give me a hard number (20, 15, 10, 5, 0) based on the based upon input in b3. The first statement works correctly and returns a 20 if >69 in b3, however, the remainder of the formula returns "True" rather than a number. Can you tell me what I am doing wrong? Thank you.

  31. Hi,

    I'm new to this but want to do the following:

    if cell D11 is 6 then then the payment is £450 plus £60 for each additional number

    ie. 9 people attended = £450 + (3*60) = £630

    Can anyone help?

    Thanks in advance

    1. Sorry but some of my original message went AWOL.

      if D11 is 6 = £450 + £60 for each additional number (ie 9 people attended = £450 + (3*60) = £630

      Thanks

      1. Hi Alison,

        If my understanding of the task is correct, the following formula should work a treat:

        =IF(D11=6, 450, 450+(60*(D11-6)))

  32. How can i replace an number to an text

    Exmaple:

    If i type 1 in an box and press enter. The text in the box will be replaced with "hey"

    I type 1 and this is the output:
    ____________
    |___hey____|

  33. Hi ,

    I want formula for the below.

    Define buckets based on the below logic
    Bucket C – Less than 2 week from today
    Bucket D – More than 2 weeks and less than 1 month from today
    Bucket E – More than 1 month and less than 3 months from today
    Bucket F – More than 3 months and less than 6 months from today
    Bucket G – More than 6 months and less than 12 months from today
    Bucket H – More than 12 months and less than 2 years from today
    Bucket I – More than 2 years and less than 5 years from today
    Bucket J – More than 5 years from today

  34. I'm trying to work out commission structures in excel, for example if the fee is between 25k-49.99k, then the commission is 1.25%, if fee is between 50k-99.99k then commission is 1%, if fee is between 1 lacs - 199.99 lacs then commission is 0.75%, if fee is 2 lacs and above commission is 0.5%

  35. awesome post. very helpful!!

  36. Hi Svetlana,

    I want to calculate the difference between date 1 "I3" and date 2 "L3", but in case of date 2 "L3" not available I want to calculate it between 1 "I3" and today date so, I wrote this formula but I keep receiving wrong result cause of not applying today formula
    =IF(L3,"=(TODAY())-(I3)",(L3-I3))

    1. Hi Muahammad,

      Try this formula:

      =IF(L3="", TODAY()-I3, L3-I3)

  37. Thank you!! Your article is super clear! I had never understood the logic behind this functions until now.

  38. I'm trying to find the max excluding the middle portions of the data set. Using the table below, i'd like to find the max above Time=7 and below time=4. I've tried various permutations

    Time Total
    1 0
    2 0
    3 12
    4 0
    5 20
    6 19
    7 0
    8 11
    9 0
    10 0

    I think =MAX(IF(OR(A2:A11>7,A2:A11<4),B2:B11)) should work but it just returns the max of the entire data set (ie 20). If i break up the formula (ie exclude the OR) and add a secondary step it works. Any tips?

  39. Hi!
    This is my current formula: =if(and(ISBLANK(F2),ISTEXT(G2)),"New",)
    Right now, if there is no text in F2 AND there is text in G2, the cell will say "New"

    I want to add to the formula so it's this way:
    If there is no text in F2 AND there is text in G2, the cell will say "New" but IF there is text in G2 and F2, the cell should say "Ad Proofing"

    Could someone help me with this? Thank you!

    1. =if(and(ISBLANK(F2),ISTEXT(G2)),"New","Add Proofing") try this should help

  40. I would like to add multiple conditions to my spreadsheet for example: for every A.. that has "name" and B.. that has 1 then add 0.05 to G1

  41. Dear Sir,
    How can use over 9 conditions.

    =IF(H11=2,I19+H19+H20+H21,IF(H11=3,I20+H20+H21,IF(H11=4,I21+H21+H22,IF(H11=5,I22+H22+H23,IF(H11=6,I23+H23+H24,IF(H11=7,I24+H24+H25,IF(H11=8,I25+H25+H26,IF(H11=9,I26+H26+H27))))))))

    1. It may have to do with the version of Excel you are using. If it is an older version, I believe you can only have a maximum of 7 conditions. The newer versions allow up to 64. You may want to look into that.

  42. hie.
    l still need help my formula isn't giving me an answer

  43. l'm still having problems with finding grade using the average mark

  44. l need help on calculating grade using average mark.l used =if(average (B2:G2)>75,"A",if(average (B2:G2)>60,"B",if(average(B2:G2)>50,"C",if(average(B2:G2)>45,"D",if(average(B2:G2)>40,"E","U"))))).It says there is an error in my formula.please help.

  45. hi,
    i want a formula so that i come to know that if a particular cheque issued then amount of that cheque will appear in next cell,
    for example

    AMOUNT CHQ NO STATUS DATE OF ISSUE DATE OF CLEARENCE Amount(if cleared)
    2977 54808 issued 21.04.2016 25.04.2016

    as above mentioned i want to next cell which is blank shows the amount if a particular cheque has cleared from bank and also i've given the clearance date of cheque
    please guid
    Thanx & Regards
    Ghayas Ahmad

  46. I am trying to make an If then statement for the following:

    If box F5 = 100, then box F6 = 3000

    if box F5 100, then box F6 = 5 x every number over 100 + 3000
    (example if F5 = 105, the box F6 would need to be (5*5)+3000

    Could you help me make a formula? Please?

    1. it cut off part of my formula:

      also add in: if box F5 < 100, than F6 = 3000

      1. Hi Emily,

        Try the following formula:

        =IF(F5<=100, 3000, 5*(F5-100)+3000)

  47. I have a spreadsheet that has a due date in column j, and a status of open or closed in column K.
    I need Column L to calculate if the date is after today's date, and the status is open, then it says On Track, if the date is after today's date and the status is closed, then it says completed, and if the date is before today's date and the status is either open or closed then it shows Delayed... I've figured out how to get it to show On Track, Completed and Delayed based on just the date in column j, but I can't figure out how to get the status involved.

    1. Hi Kayla,

      Please use the below function,

      =IF(AND(J14>TODAY(),K14="Open"),"On Track",IF(AND(J14>TODAY(),K14="Close"),"Completed",IF(AND(J14<TODAY(),OR(K14="Open",K14="Close")),"Delayed","")))

      Thanks,
      Prabath

  48. Hi,

    I have scenario,

    I am trying to get all the blank fields from the column, for ex- if I have this column.

    13 years 6 months 0 days
    34 years 5 months 0 days
    10 years 9 months 0 days
    14 years 0 days
    6 years 8 months 0 days
    5 years 11 months 0 days
    23 years 6 months
    6 years 9 months 0 days
    8 years 9 months 0 days
    30 years 9 months 0 days
    7 years 7 months 0 days
    15 years 4 months 0 days
    45 years 3 months 0 days
    40 years 10 months 0 days
    33 years 2 months 0 days

    13 years 9 months 0 days
    30 years 2 months 0 days
    29 years 10 months 0 days

    25 years 6 months 0 days
    14 years 9 months 0 days
    41 years 3 months 0 days
    10 years 11 months 0 days
    30 years 3 months 0 days
    15 years 11 months 0 days
    27 years 0 days 6 years

    As you can the column has the blank fields, I need to get the blank fields out from the column, also it has "NUM" error and 0, which I also need need to take out.

    Can you please tell me how to construct the formula for that.

    Thanks,
    Saurabh

  49. Hi can you help me with the conditions for this !
    If age is between 0 - 12 months then 0.5 to 1.8 µmol/L
    If age is between 1 - 6 years: then 0.7 to 1.5 µmol/L
    If age is between 7 - 12 years: then 0.9 to 1.7 µmol/L
    If age is between 13 - 18 years:then 0.9 to 2.5 µmol/L
    If age is ≥ 18 years:then 1.5 - 3.5 µmol/L

    1. Hi Sam!

      Use the following formula to calculate a months count
      =(YEAR(NOW())-YEAR(A1))*12+MONTH(NOW())-MONTH(A1)

      So your formula is:

      =IF((YEAR(NOW())-YEAR(A1))*12+MONTH(NOW())-MONTH(A1)>18*12,"1.5 - 3.5 µmol/L",IF((YEAR(NOW())-YEAR(A1))*12+MONTH(NOW())-MONTH(A1)>13*12,"0.9 to 2.5 µmol/L",IF((YEAR(NOW())-YEAR(A1))*12+MONTH(NOW())-MONTH(A1)>7*12,"0.9 - 1.7 µmol/L",IF((YEAR(NOW())-YEAR(A1))*12+MONTH(NOW())-MONTH(A1)>1*12,"0.7 - 1.5 µmol/L","0.5 to 1.8 µmol/L"))))

      Please note A1 should be contain a birth date.

    2. Hi,

      use this function,

      =IF(A2<1,"0.5 to 1.8 umol/L",IF(A2<6,"0.7 to 1.5 umol/L",IF(A2<12,"0.9 to 1.7 umol/L",IF(A2<18,"0.9 to 2.5 umol/L","1.5 to 3.5 umol/L"))))

      Thanks,
      Prabath

  50. Hi,

    If above once is not clear. Please assist me by using this one.

    Invoice # Value

    MYEX0455477 10.00
    MYEX0456058 5.00
    MYAE0154262 8.00
    MYEX0456603 8.00
    MYEX0456601 7.00
    MYAE0154534 2.00
    MYEX0457138 11.00
    MYEX0457438 9.00
    MYAI0069730 14.00
    MYEX0457318 6.00

    Matching Amount 20.00

    Combinations
    MYEX0455477 10.00
    MYAE0154262 8.00
    MYAE0154534 2.00 20.00

    MYEX0455477 10.00
    MYEX0456603 8.00
    MYAE0154534 2.00 20.00

    MYEX0456058 5.00
    MYAE0154262 8.00
    MYEX0456601 7.00 20.00

    MYEX0456058 5.00
    MYEX0456603 8.00
    MYEX0456601 7.00 20.00

    MYEX0457138 11.00
    MYEX0457438 9.00 20.00

    MYAI0069730 14.00
    MYEX0457318 6.00 20.00

    Thanks,
    Regards,
    Prabath

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