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 89. Total comments: 4830

  1. In a purchasing department, there will always be a lot of suppliers to handle and a lot of POs to make. I have created a drop down box of the list of suppliers, and what formula can i use that if i selected a supplier name, the address and the vedor code will appear on a different cell.

    sample is if i choose Supplier A in A11, address will appear in A12 and vendor code will appear in M7

    hope you will be able to help me.

    Thanks!

    JUBI

  2. Hi. I need to write a formula in one cell to say "if we have market data (cell L10), use the market data. If not, check to see whether the average company rates fall between the preferred and floor rates.

    Thank you!

  3. HI,

    ACTUALLY I REQUIRED FORMULA FOR KNOWING PRESENT STATUS OF ACTIVITY. WE UPDATES ACTIVITIES DATE WISE IN A SHEET AND OTHER SHEET WE UPDATE ALL BRIDGES NO. NOW I AM LOOKING FOR THAT MY LAST ACTIVITIES OF BRIDGES IS AUTOMATICALLY UPDATE IN OTHER SHEET.

    REGARDS,

    KUNDAN

  4. Hi. Iam trying to calculate a formula which calculates using 2 different prices.
    One column is old price, and second is new price.
    I need excel to calculate using the only new price in second column which is originally empty, whenever a value present. Can anyone help?

    Thanks
    Dandy

  5. Thanks Svetlana, for the reply

  6. Hi,

    I have a situation where i want to use the IF formula. Column A has dates. column B has Carpet area of a flat. Column C has additions of areas such as addition of all areas above. Now, what i want in Column D is if the date is 31-March-16 or less than that, the column D should not add the areas and if it is mote than 31-Mar-16, the it should add the column above. Example is as below:---

    A B C D
    31-Mar-16 1960 1960 1960
    31-Mar-16 1960 3920 1960
    31-Mar-16 1960 5880 1960
    01-Apr-16 1960 7840 3920
    05-Apr-16 1960 9800 5880

  7. Hello, I am trying to reference a cell in another sheet that will change based on the date. Sheet 1 has 3 cells that I use to count the number of tasks completed in a day. Sheet 2 is a tally for each day, so for the 5/20 row on sheet 2, I would want the values from the 3 cells on sheet 1 to flow to that row when the today's date is 5/20. On 5/23, I would want the same cells from sheet 1 to flow to the 5/23 row on sheet 2. I tried the following function: =IF(TODAY=A15,Sheet1!B2,0) where A15 is the date (5/20/16 in today's case) but I get the #NAME? error. Thanks.

  8. Hi Svetlana

    Hi have a formula that I'm struggling with. Can you please assist
    =IF(D9:Q9>0,(D4:Q4="PH")+(D9:Q9))
    Basically I want my Public Holiday column to add the hours in Row 9 only if Row 4 has the value PH

    WAGES
    F/Night: 26/3/2016 - 08/04/16
    Hours + Days WORK PAYMENTS
    PH PH
    SHIFT PAY NAME 26 27 28 29 30 31 1 2 3 4 5 6 7 8 PER Nor Over Sun P/H Sick Fam Res Absent Leave
    # # SA SO MA DI WO TH FR SA SO MA DI WO TH FR F/NIGHT 1x 1.5x 1.5x 2x 1x 1x 0 1x
    TEAM A
    1 229 Oscar Matemane Day Day Night Day Day Day Off off Off Day Day Day Day Absent
    Hours 10 10 9 11 11 11 0 0 0 11 11 11 11 FALSE 106 #VALUE! 10 #VALUE!

  9. I have a data validation list column (in cell O2) with the following pull down options: Elimination, Substitution, Engineering, Administration, Culture, PPE. If Elimination is selected, I would like the adjacent cell to return the value 0.1. If Substitution is selected, the adjacent cell should have the value 0.3. Other values for remaining text are 0.5, 0.75, 0.8, and 0.9.

    If you can figure this out you will be my forever hero!

    1. Here i have one question..Dont know its possible with excel or not..If any one have idea than tell me..
      I have data validation list in cell D5 with the drop down options: Residential , Commercial..I have another drop down list in E5 with options Flat , Bunglow , Shop , Office ...If i select Residential in D5 then in cell E5 it shows only 2 option Flat , Bunglow..Dont show me another options like Shop , Office..

  10. Hello!

    I'm trying to make a formula based off a date column.
    Ideally, I would like to have a separate column populate a 'blank' or "Follow UP" based on whether or not the date is older than 15 days.

    I tried =IF(C1-TODAY()>15,"FOLLOW UP","") but obviously it did not work.

    Am I on the right track?

    1. Hello Claire,

      You were almost there! :)

      =IF(TODAY()-C1>15,"FOLLOW UP","")

  11. please help me how to make the formula... this is the situation!

    Name of Studet PG MG SFG FG CG Remarks
    1 Homer Lee 1.5 2.5 3 1.9 2.2 PASSED
    2 Howard Chan 3.2 3.5 3.4 3.8 3.5 FAILED
    3 Mark Tee 1.6 1.8 1.4 2.2 1.8 PASSED
    4 John Bree DROPPED DROPPED DROPPED DROPPED DROPPED FAILED

    WHAT SHOULD i do in my consolidated Grade (CG) that will appeared droppped not FAILED TO JOHN BREE

  12. hi,

    if A2 is less than (negative) or equals to zero then it should come the same value as in A2,

    But if A2 is greater than zero then it should result A2 * 10% ( or any percent which i want to put)

    reply

    1. Hi Naresh,

      Here you go:

      =IF(A2<=0, A2, A2*10%)

  13. I need a formula whereby if the value of cell A2 is 199 or less, then "Low," if the value of cell A2 is from 200-399, then "Medium," or if the value of cell A2 is 400 or above, then "High."

    Would appreciate any help!

    1. Hello!

      Try this formula:

      =IF(A2<=199, "Low", IF(A2<=399, "Medium", "High"))

  14. if A1 is 372 the total must reflect in C1

  15. I used the following formula to print the value of the cell that met the conditions but what should I add to the formula not to show a blank instead check the next cell if it has value and print it accordingly without leaving a blank space:

  16. Hi,
    Please help. This formula I need:

    Evry name from column A have value in column B (for example, name in cell A1 have value in cell B1, name in cell A2 have value in cell B2 etc.)
    Some of that names from column A I have in column D, and I need enter matching values in column E for evry name from column B.
    So I need some formula like this:
    IF value from d4 is located in column A enter here matching value from column B.

    Thank you.

  17. looking for a formula for the following:

    IF F5 is < or=100, then 4
    if F5 is 125 then 5
    if F5 is 150 then 6
    if F5 is 175 then 7
    if F5 is 200 then 8
    if F5 is 225 then 9
    if F5 is 250 then 10

    Thank you!

  18. s.no. name credit period Overdue Total overdue 30 45 60 90 120
    1 adam 30 ? 824 5 45 51 658 65
    2 rab 45 ? 1338 6 2 25 654 651
    3 bab 60 ? 1041 45 4 469 159 364
    4 carv 90 ? 1044 5 42 748 124 125
    5 careg 120 ? 973 45 42 49 512 325

    819

  19. Can any one give the formula to given table.

    s.no. name credit period Overdue Total overdue 30 45 60 90 120
    1 adam 30 ? 824 5 45 51 658 65
    2 rab 45 ? 1338 6 2 25 654 651
    3 bab 60 ? 1041 45 4 469 159 364
    4 carv 90 ? 1044 5 42 748 124 125
    5 careg 120 ? 973 45 42 49 512 325

    i want to get the sum after sum after the credit period amount with the forumula.

  20. hi

    i want to create a formula using the if function to calculate compensation. i have 5 staff with each a different joining dates but same leave date.

    can anyone please guide me?

  21. 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.

  22. 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

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

  24. 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?

  25. 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

  26. 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)

  27. 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.

  28. 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

  29. 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.

  30. 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.

  31. 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.

  32. 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.

  33. 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)

  34. 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.

  35. 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

  36. 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

  37. HI,

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

  38. 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

  39. 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

  40. 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";"")

  41. =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")))))))))

  42. 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)

  43. hi

  44. 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"))))))

  45. 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")

  46. 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

  47. 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.

  48. 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)))

  49. 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

  50. Hi,

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

    Thanks & Regards.

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