Comments on: How to use IF function in Excel: examples for text, numbers, dates, blanks

IF is one of the most popular and useful functions in Excel. Generally, you use an IF statement to test a condition and to return one value if the condition is met, and another value if the condition is not met. Continue reading

Comments page 90. Total comments: 4830

  1. I want to set a formula for my KRI, if my depoist is 3m kri should score 15 ( 100 %), if 2M kri should score (2/3) 66% of 15 i.e 10. The bench mark is 3 which is 100% and KRI score is 15 (100 %) and if the deposit fall below KRI should move with the same percent, how Am i suppose to do this , please help.

  2. Hi

    I want that if me or someone else fill in, for example in cell A2 the number 160161 it should be in cell A3 the time 05:30

    Also if i or someone else fill in a number that not exist from my numbers then a text for example "wrong number"

    Can i get help with a formula for that?

    IF=160131 in cell A2 then 05:30 in cell A3.
    And IF not none of the number then text wrong number

    Thanks in advance

    1. Hi Tommy,

      If you want to see value "05:30" when A2 contains number 160161, you can enter the following formula into A3:
      =IF(A2=160161,"05:30","wrong number")

      If you want to make sure the cell is formatted as time, please use the following formula instead:
      =IF(A2=160161,TIMEVALUE("05:30"),"wrong number")

      I hope this helps

  3. When I use SUM to add up a column of numbers returned by an IF formula, it does not work. Why is that?

  4. I want to use SUM to add up the column of numbers resulting from an IF formula, but it returns 0. What should I do please?

  5. hi
    i'm trying to use IF in condition more than 13
    below is formula i put in excel, it wouldn't work

    =IF(AP3=1,"mkra",IF(AP3=2,"kumÖ³",IF(AP3=3,"mina",IF(AP3=4,"emsa",IF(AP3=5,"]sPa",IF(AP3=6,"mifuna",IF(AP3=7,"kkáda",IF(AP3=8,"sIha",""))))))))&IF(AP3=9,"",IF(AP3=10,"",IF(AP3=11,"","")))

    Could you please help me?

    Best regard,
    Sreymom

  6. I'm trying to determine the monthly salary of our instructors. They get 30$/hr if they teach less than 120 hours/month, but receive 35$ for each additional hour after the 120 hr threshold.

    This is the formula I put in, but it wouldn't work:

    =IF(C2>120, (120*D2)+(C2-120)*35;C2*D2)

    Could you please help me out?

    thanks,
    melih

    1. Hello Melih,

      Your formula is correct except for a typo and one little detail. Depending on the locale you have in Excel, please make sure you use either commas or semicolons as separators, i.e. either
      =IF(C2>120,(120*D2)+(C2-120)*35,C2*D2)
      or
      =IF(C2>120;(120*D2)+(C2-120)*35;C2*D2)

      Assuming you always have the regular rate per hour in cell D2, you need to make it an absolute reference so that it doesn't change to D3, D4, etc. in other rows:
      =IF(C2>120,(120*$D$2)+(C2-120)*35,C2*$D$2)

  7. GD,

    I am working on stock control excel table. I need the IF formula to give me the updated price for the updated stock quantity if I receive an item with new price. How can I do this please?

    BR.

  8. Can you please help me to make a formula for the dates of delays

    sample

    (A)Date Submitted (B)Date Return (C)No. of days taken
    14-Dec-15 17-Dec-15 3
    14-Dec-15 I need a value of this one for everyday counting till the return date to show it is overdue and continue to all spreedsheet.

    hope you can help me

    Regards,

    Jm

  9. how do I solve this problem In cell I5, enter an “AND” IF function that enters “F5*.10” if the value in the Program range is English AND the value in the Level range is 1. If neither of these criteria are met, nothing is entered. The purpose of this IF function is to offer a 10% discount to students who are taking Level 1 English. You should see FALSE in cell I5 and $200 in cell I7. nI need the answer ASAP. thank you,

    1. Hello Anne,

      Assuming you have Programs in column G and Levels in column H, you can use the following formula:
      =IF(AND(G5="English",H5=1),F5*0.1,"")

      It will check that the cell in column G contains "English", and the cell in column H is "1". If both conditions are met, it will multiply value in F5 by 0.1. If either of the conditions is not met, it will not enter anything.

      If your task is different, please describe it in more detail and provide an example of your data, we'll do our best to assist you.

  10. I have column having values + values, - values and blank (0). I want to show the result on the next column "OK" for + values, "NOT OK" for -ve values and "PERFECT" for blank (0) values. how can do it. For +ve and -ve values i can able to do it with if function. how can i add the blank cells.

  11. if the month is of 30 days=
    for example,- attendance is 24 then 200, 25/26 then 220, 27/28 then 240,29/30 then 260.
    same as if the month is of 31 days,
    attendance is 25 then 200, 26/27 then 220, 28/29 then 240,30/31 then 260.
    please suggest.

  12. Dear Madam,

    i have a excel for branch reconcilation, same value repeated in my excel sheet but another sheet only shows two or three amount but it is same . how can i compare the sheet.

  13. OMG, Jenny I have a similar situation!!!

    I need to change Excel rows from one colour to another when a text name is changed is a specific column where each cell has one of 4 titles.

    So yes, is anyone able to help please...?

    With thanks in advance too :o)

      1. I'm sorry, but didn't find you reply very helpful, so found another web-site that was, and the simple answer is to:
        Highlight line you want to change that has the key word written in it (in my case it is the word Forecast)

        go into Conditional Format option

        choose New Rule

        in "Edit the Rule Description:" type the coordinates of the cell which has the key word (on my spreadsheet this was =$G87="Forecast")

        Click on the Format icon and set whatever format you'd like to have occur & ckick ok)

        Then when its showing as a Rule, amend the "Applies to" coordinates from what is in there (which will be the single line you originally highlighted) to all of the spreadsheet you want this rule to apply to (so for me this was =$G$50:$W$500 )

        Click on the "Apply" icon (lower right corner)

        And hey presto it works!

        All good wishes - Louise :o)

  14. Hello,

    I need a help to do a conditions using date in excel 2007:

    Query:

    I need to set a follow up with the date in excel. There are two status. Open and close.

    Conditions:

    1)If status "open" & date of today more than 3 days then "Remainder" and color changes (entire row should be highlighted).

    2) If status "Open" & date of today more than 5 days then "Exceeded" and another color changes (entire row should be highlighted).

    3) If status "closed" then "Completed".

    Can any one help me with this issue?

    Thank you in advance.

  15. Hi,

    My query is IF (A1>15000,"150",IF(A1>20001,"200")
    answer is not displaying by applying this formula
    what i required is IF A1 cell is greater than 15,000 answer should come 15. If A1 cell is greater than 20,000 answer should come 200

  16. HI,

    in IF condition formula required,
    ex: A1>15000,'150'A1>20000,'200'
    if A1>15k answer should be 150 if A1>20k=200

    can any one help on this

  17. HI,

    in IF condition formula required,
    ex: A1>15000,'150'A1>20000,'200'
    if A1>15k answer should be 150 if A1>20k=200

  18. HI ,
    I have excel sheets.
    Excel 1,Excel 2.

    Excel 1 having 10 fields
    Ecel 2 having 3 fields of Excel 1.

    Excel 1 fields
    no requester date status

    Excel 2 Fields
    requester date status

    Here,what my query is
    i want display in Excel 2 only status pending items with the related fields.

    Can you help me on this .
    Thanks in advance.

    1. Hi veeru,

      The simplest way is to filter sheet Excel 1 by the status column and copy the filtered values to sheet Excel 2.
      To filter the column please go to the Data ribbon tab, click Filter and then select the pending value in the status column.

      1. I WANT TO DO EXCEL SHEET CELL COLOR CHANGE LIKE IF I PUT "P" THEN THAT CELL WILL CHANGE IN GREEN . IF I WRITE A THEN IN RED. IF PUT HALF DAY THEN YELLOW

  19. Hello

    I am trying to look for a formula that will look in on cell, and if true retrieve data from another cell. the function that I am trying to use is
    =IF(B30="X","(E36)","")

    I am trying to retrieve the data in cell E36. I think i need to use the IF function Because if B30 has an x then I want it to retrieve the date in E36 and if not I need it to be blank

    thank you for help

  20. I have this formula
    =IF(ISNUMBER(SEARCH("ΜΑΚΑΡΟΝΙΑ";ΠΡΟΓΡΑΜΜΑ!E14)); "1";"")
    It works fine but I want to search text in two cells
    Thanks

    1. Hi GIANNIS,

      Please try to use the OR function in the first parameter:
      =IF(OR(ISNUMBER(SEARCH("ΜΑΚΑΡΟΝΙΑ";ΠΡΟΓΡΑΜΜΑ!E14)), ISNUMBER(SEARCH("ΜΑΚΑΡΟΝΙΑ";ΠΡΟΓΡΑΜΜΑ!D14))); "1";"")

  21. =IF(G5=13,"1600",IF(G5=20,"1700",IF(G5=25,"2400",IF(G5=40,"12000",IF(G5=50,"22000",IF(G5=80,"30000",IF(G5=100,"41000",IF(G5=150,"145000",IF(G5=200,''322000'')? why it can not working? please kindly to help me! Thank you inadvance.

    1. Hi Koung,

      Please use the following formula:
      =IF(G5=13, "1600", IF(G5=20, "1700", IF(G5=25, "2400", IF(G5=40, "12000", IF(G5=50, "22000", IF(G5=80, "30000", IF(G5=100, "41000", IF(G5=150, "145000", IF(G5=200, "322000")))))))))

  22. Can someone help me with this ...

    =IF(FIND(" (",D2),LEFT(D2,(FIND(" (",D2)-1)),E2)

    The True condition (finding a "(" in the string works) in row 2 but the False fails with a "#VALUE!" error in row 3

    D2 contains "Lafayette, LA (LFT)" and E2 contains "LA (LFT)" ... result should contain "Lafayette, LA" - it does!
    D3 contains "Neurnberg, Germany" and E2 contains "Germany" ... result should contain "Germany" - it fails!

    Thanks.

    1. Hi Suds,

      You should use the following formula:
      =IF(NOT(ISERROR(FIND(" (",D3))),LEFT(D3,(FIND(" (",D3)-1)),E3)

  23. hi

  24. Is there anyway to merge all this together in one field?

    If A1 is blank = Jack
    If A1 is not blank, and B1 is blank, and C1 is blank, and D1 is blank = Jill
    If A1 is not blank, and B1 is blank and D1 is blank = Sunny
    If A1 is not blank, and B1 is blank, and D1 is not blank, and E1 is not blank = Sunny
    If A1 is not blank and E1 is blank and B1 is not blank = Cookie
    If A1 is blank, B1 is not blank and D1 is not blank and E1 is blank = Mike
    If A1 is not blank and B1 is not blank, and C1 is not blank = Mike

    1. This is what I have but there is two problem. One i'm not able to add the last statement in and the second the results just shows up false. Any guidance would be appreciated.

      =IF(ISBLANK(A1),"Jack", IF(AND(ISBLANK(B1), ISBLANK(C1), ISBLANK(D1)), "Jill", IF(AND(ISBLANK(B1), ISBLANK(D1)), "Sunny", IF(ISBLANK(B1), "Sunny", IF(ISBLANK(E1), "cookie", IF(AND(ISBLANK(A1), ISBLANK(E1)),"Mike"))))))

      1. Oops my mistake. All my E1 are actually C1. Sorry.

        So here it is again.
        1. If A1 is blank = Jack
        IF(ISBLANK(A1),"Jack",

        2. If A1 is not blank, and B1 is blank, and C1 is blank, and D1 is blank = Jill
        IF(AND(ISBLANK(B1), ISBLANK(C1), ISBLANK(D1)), "Jill",

        3. If A1 is not blank, and B1 is blank and D1 is blank = Sunny
        IF(AND(ISBLANK(B1), ISBLANK(D1)), "Sunny",

        4. If A1 is not blank, and B1 is blank, and D1 is not blank, and E1 is not blank = Sunny
        IF(ISBLANK(B1), "Sunny",

        5. If A1 is not blank and C1 is blank and B1 is not blank = Cookie
        IF(ISBLANK(C1), "cookie",

        6. If A1 is blank, B1 is not blank and D1 is not blank and C1 is blank = Mike
        IF(AND(ISBLANK(A1), ISBLANK(C1)),"Mike",

        7. If A1 is not blank and B1 is not blank, and C1 is not blank = Mike
        ???

        Current code i'm stuck on without statement 7

        IF(ISBLANK(A1),"Jack", IF(AND(ISBLANK(B1), ISBLANK(C1), ISBLANK(D1)), "Jill", IF(AND(ISBLANK(B1), ISBLANK(D1)), "Sunny", IF(ISBLANK(B1), "Sunny", IF(ISBLANK(C1), "cookie", IF(AND(ISBLANK(A1), ISBLANK(C1)),"Mike"))))))

        1. Hi TinWin,

          Please use the following formula:
          =IF(ISBLANK(A1), "Jack", IF(AND(ISBLANK(B1), ISBLANK(C1), ISBLANK(D1)), "Jill", IF(AND(ISBLANK(B1), ISBLANK(D1)), "Sunny", IF(AND(ISBLANK(B1), NOT(ISBLANK(D1)), NOT(ISBLANK(E1))), "Sunny", IF(AND(ISBLANK(E1), NOT(ISBLANK(B1))), "Cookie", IF(AND(NOT(ISBLANK(B1)), NOT(ISBLANK(D1)), ISBLANK(E1)), "Mike", "Mike"))))))

  25. Hi,

    If anyone can help?

    I am trying to use if function to show the text "probable" is ok. It is a very simple formula but I am completely baffled that "probable" comes as a false value when it should be a true value. Anyone have a solution to this? Results below with formula;

    certain ok =IF(B3="certain","ok","not ok")
    probable not ok =IF(B4="probable","ok","not ok")
    possible ok =IF(B5="possible","ok","not ok")
    probable not ok =IF(B6="probable","ok","not ok")
    red ok =IF(B7="red","ok","not ok")
    chair ok =IF(B8="chair","ok","not ok")
    laptop ok =IF(B9="laptop","ok","not ok")
    maybe ok =IF(B10="maybe","ok","not ok")
    probability ok =IF(B11="probability","ok","not ok")
    probable not ok =IF(B12="probable","ok","not ok")

    Why is "probable" seen as false(not ok)?

    Looked everywhere can't find a solution

    1. Hi Mohammed,

      It seems you have spaces in your cells. Please try to trim the cell value before comparing.

      =IF(TRIM(B4)="probable","ok","not ok")

  26. i want to stop the TAT calculation after enter my final date, could you please let me know that formula for that, and i know how to use TAT calculation, only i want to know if i enter 3rd date it should be freeze.

    1. can you send me sample file

  27. Scenario: You have been provided with a list of expenses for the month- eg Column A is the $, and column B is the cost centre (using a drop down list). eg $1,000 cost. Cost centre is ADMIN

    I want a spreadsheet whereby it can automatically move the expense into relevant cost centre, and then give me the total for the month.

    Dean

    1. Hi Dean,

      To help you better, we need a sample table with your data in Excel and the result you want to get. You can email it to support@ablebits.com. Please add the link to this article and your comment number.

  28. If Cell A2 is greater than cell B2 then Cell C value is 1, If Cell A2 is smaller than cell B2 then Cell C value is 2, If Cell A2 is equal to cell B2 then Cell C value is 0. Can anyone let me know the function

    1. Hi Taufiq,

      Here you go:
      =IF(A2>B2, 1, IF(A2<B2, 2, 0))

      1. Dear Taufiq,

        Put your values in A2 & B2 , PASTE this formula in C2.

        this formula can be make shorther but for your understanding i have used 3 formulas

        =IF(A2>B2,1,IF(A2<B2,2,IF(A2=B2,0)))

  29. Dear Sir,
    I want to do stock ageing.Our item reference sample is 89p25. Here each year represent different parcel number for eg.(p25,p26,27). How to set formula in another sheet.Please advise.

    Thanks & Regards

  30. Hi,

    We Want Excel Sheet of "How can used "=if".So, Kindly Provide to me As soon as possible.

    Thanks & Regards.

  31. Hi,

    I want a formula for timing.
    Ex: if my office time is 9:00 AM in morning when i came late 10 Mins , then the formula should reflect as "Minimal Delay" And if i came across 10 Mins > Greater to < 30 Mins lesser then it should have to reflect as "Maximum Delay", However the delay timings would get different colour for "Minimal Delay", "Maximum Delay", could you help me to get formula for this.

    Thanks in Advance

  32. I want to know a formula that could say If I should "follow up" a delivery 5 days prior to my actual request or "not", from the date I requested.

    Many thanks in advance!

  33. I'm trying to develop a formula that turns wealth ratings into numeric scores

    $100M+ = 8
    $50M-$99.9M = 7
    $25M-$49.9M = 6

    and on down the line.
    Here is the IFS statement I was starting with:

    =IFS(V2="$100M+"),8),(V2="$50M-$99.9M"),7),(V2="$25M-$49.9M"),6),(V2="$10M-$24.9M"),5), (V2="$5M-$9.9M"),4),(V2="$3M-$4.9M"),3),(V2="$2M-$2.9M"),2),(V2="$1M-$1.9M"),1),(ISBlank(V2),0)))))))

    It didn't work. Is there a way to do this?

  34. Kindly Resolve this

    If ( Column1 = 'Completed', Date (like 29-Apr-2016), Process)

  35. Hi
    Value in cell A3 is 10
    I want to check this value tn 4 Different Criteria
    1)Less than 20
    2)Greater than 20 but less than 50
    3)Greater than 50 but less than 80
    4)greater than 80
    Please help
    Regards
    Venkat

  36. i hv a value in say B2 such as these: BAHJHB16A0001 or BOHJHB16A0003.

    I want to put in a formula in A2 if value in B2 starts with BAH then A2 should be BAH.

    If B2 starts with BOH then A2 should return value as BOH.

    if i use the sign = or it is not accurate. I would appreciate some help. Thank you.

  37. Hey,

    Hows you ?

    I need a formula where if i select range from a2 to a300 than result will appear on E2 TO E300

    For Example , if my A from 1 to 300 Column contains all vendors name & my B contains all Vendors account no.

    I need a formula where if i select Vendors name in column A from Drop down list than Vendors account no should come automatically...

    Can you help me with this

  38. Trying to enter a formula to tell me if the word "error" is anywhere in a single row between columns H and BT. Is this possible?

  39. Please help me to figure out a formula for the below scenario :-

    If the cell value (G20) is less than 80%(C2) then F22 should be 0

    If the cell value (G20) is in between 80% to 90% (C2 to D2) then F22 should be C8*c3,
    If the cell value (G20) is in between 900% to 100% (D2 to E2) then F22 should be C8*D3,
    If the cell value (G20) is in between 100% to 110% (E2 to F2) then F22 should be C8*E3,
    If the cell value (G20) is in between 110% to 120% (F2 to G2) then F22 should be C8*F3,

  40. cell A1 containing 1:Mahabharat
    cell A2 containing 2:Ramayan
    cell A3 containing 3:Geeta

    i want give formula in "2" number containg in cell A2. i.e. i want result of "2" by formula of "1" + 1.

    kindly hepl me in above problem

  41. Hi,
    I have one question.
    Actually i just want to create a new cell if my "if Condition" become true and not to create any cell if condition become false.
    Can you please suggest is there any way to resolve with this issue ?

    Thanks in advance.

    1. You may have to learn VBA for this.

  42. Hi,

    Is there an 'If Statement' formula for a pie chart that will say ...
    'If A4 = 0 dont include, if A4 = >1 include' ??

    Thanks

  43. B6 is 70% And D19 is 0 i need the result is Needs Improvement.

    Now I'm Trying with this one which is not getting the result.

    IF(AND(B6>=70%,D19=0,"Needs improvement".

    Please help me.

    1. =IF(AND(B6>=70%,D19=0),"Needs improvement","")

  44. B6 is >70% And D19 is 0 i need the result is Needs Improvement.

    Now I'm Trying with this one which is not getting the result.

    IF(AND(B6>=70%,D19=0,"Needs improvement".

    Please help me.

  45. Hi,

    I would like to create a formula for a spreadsheet.

    If D4 = 1, then F4 = $15
    If D4 = 2, then F4 = $20
    If D4 = 3, then F4 = $25
    If D4 = 4, then F4 = $30
    If D4 = 5, then F4 = $35
    If D4 = 6, then F4 = $40

    etc.. all the way to D4=10, then F4=$60 ($5 increments).

    Essentially, all I would like to do is enter the number '5' into D4 and the appropriate total cost will automatically appear in F4.

    Thanks in advance!

    1. Hi,
      Type this into F4,

      =D4*5+10

      And format it as currency ($)

      Using If loops make it messy. If you must use If, use the following,
      =IF(D4=10,60,IF(D4=9,55,IF(D4=8,50,IF(D4=7,45,IF(D4=6,40,IF(D4=5,35,IF(D4=4,30,IF(D4=3,25,IF(D4=2,20,IF(D4=1,15,"Enter a correct value"))))))))))

  46. Kindly prepare a formula or correct this formula

    If a man bought x, he is entitled for 0.8*the price
    If a man bought y, he is entitled for 0.8*the price if 0.8 *the price < 100 otherwise he will be paid 100

    If a man bought z, he is entitled for 0.8*the price if 0.8 *the price < 1500 otherwise he will be paid 1500

    =+IF(G2=0,0.8*L2,(IF(AND(G2=1,L2*0.8<100),0.8*L2,100,(IF(AND((G2=2),(L2*0.8<1500)),0.8*L2,1500,(IF(G2=3,L2,L2)))))))

  47. I would like to create a formula by if

    check value of a cell A2 = 1,
    if true its will select a already written value from a cell H2,
    if false we wants go for another checking A2 = 2,
    if second checking is true its will select a already written value from a cell H2,
    if second checking is false we wants go for another checking A2 = 3
    if Third checking is true its will select a already written value from a cell H3
    if Third checking is false we wants go for another checking A2 = 4

    its will a continuous checking in each cell. is it possible in excel by "IF" function ?

  48. Hi,
    I would like to create an "if and" formula where: if the value in h183 is 4 and the value in a183 is 1, then the value in i183 is 2. It seems simple but I can not get the syntax correct. I have tried
    =if(AND(H183=4,A183=1)),[I183=2]
    what am I doing incorrectly.
    Thank you

    1. Hi!

      You were almost there :)

      Try to enter the following formula in I183:

      =IF(AND(H183=4,A183=1), 2, "")

  49. i want to know formulae for example that DHL, FEDEX, ARAMAX HAS DIFFERENT FUEL SURCHARGE LIKE 14.50%, 15.50% AND 13.50%....SO HOW CAN WE FILL ONE CELL FEDEX AND GET VALUE ON ANOTHER CELL 15.50%

    PLS HELP ME

  50. What will be the formula of if for multiple reason. Such as from USD 0 to 200,000 tax will be 1%, 200,001 to 500,000 will be 2.5%, 500,001 to 1500,000 will be 3.5%.

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