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 57. Total comments: 4817

  1. In Cell A2:A20 I have numeric (200.00) data. some cells are blank.
    1)how to convert blank cells into 0.00 Format cells converts numbers into 0.00 format if number is present.otherwise it is blank
    2)How to use If Isblank() formula for this conversion of blanks to 0 or if number is present, retain the same number

  2. How do I get cells in Excel to equal set amounts? For example if I was holding a competition to see how many ribbons kids could find? The ribbons would be different colors, and depending on the color the ribbon would worth different points?

    Blue=100
    Red=75
    Yellow=25
    Green=15

    Thank you in advance!

  3. Dear friends,

    i need a help for applying if condition in excel, in a column few different different text is there and few cell having MRP, if it is mrp cells have to multiply with qtys (599*12)if it is text in a cell that cells consider 300 rs * qty hot to apply if condition, please find the below the details and help me

    MRP VARIANCE FORMULA VALUE DIFF
    799 1 =IF(I6="NA",J6*300,IF(I6="",J6*300,J6*I6)) 799
    -1 =IF(I7="NA",J7*300,IF(I7="",J7*300,J7*I7)) -300
    NA 4 =IF(I8="NA",J8*300,IF(I8="",J8*300,J8*I8)) 1200
    tata 3 =IF(I9="NA",J9*300,IF(I9="",J9*300,J9*I9)) #VALUE!
    immma 7 =IF(I10="NA",J10*300,IF(I10="",J10*300,J10*I10)) #VALUE!

  4. Help! I am working on an excel and I want to know the function that if the value of D column is yes then the true value lie between 2002/9/13 to 2005/12/29 and if its false then it shows "N/A" please tell me the function need help? :)

  5. What would be the equation for 1000 ≥ certain cell block ≥ 501 =30%? For instance if certain cell block equaled 5000 the answer would be 150.

    1. But if certain cell block was 800 then the answer would be 90.

  6. Hello,
    I have a spreadsheet that tracks investigations at different facilities. I am trying to find a formula that can give me the most up to date status of the facility. Here is some background: Every time the site is inspected, a particular operating status is evaluated and "T" or "F" is entered in the cell. Since the status can change from time to time, I would like to capture the most up to date status. The spreadsheet is designed with one row per site so my range will have to be across the row. i.e. I am looking at the last time a T or F was entered in that row. I hope this makes sense.

    Thanks in advance for your help!

  7. is there a formula for multiple logical test
    example. I wanted to place a certain word into a certain cell if it contains an specific text. thank you

  8. I am inputting the follwoing formula into my spreadsheet:
    =+IF((BG2=1)*AND(BH2=1)*AND(BF2<40000),1,0)

    This is the data it is pulling:
    BF BG BH
    0.00 1 1

    My result is still showing as "0" when it should be showing "1". Can anyone explain what I am missing??

  9. hi , iam from egypt please i need to explain how to make comparison between old list numbers with new list ( ex. 1254as = 1254as
    5478ad # 5478ac
    4568ab = 4568ab )
    i know we can used if function but how by details ?
    thanks for your support

  10. =if ( 'Visual Assessment Summary'!Y7='Visual Assessment Summary'! 8, if ('Visual Assessment Summary'!Y7="M" ,6, if( 'Visual Assessment Summary'!Y7="L",5,0))

  11. I would like to show a value of yes or no depending if a vehicle reg is displayed in a colum of cells. i have tried =IF(N7="WA60 BHU","YES","NO") but this only works if wa60 appears in cell n7 i would like it to say yes if it appeared in cell n7 to n20 or no if it is not displayed.

    Thanks

  12. I want to have a formula in which if the issue date in G6 is the 1st 7 days of the month then the expiry date in H6 will be the end of that month, however if the issue date in G6 is 8th-end of month then the expiry date in H6 will be the end of the next month.

  13. I am attempting to devise a formula that will assist me to calculate the payroll for my employees. It needs to address number of hours worked & then various rates of pay for those hours.

    So far I have come up with the following:

    =IF(AJ6>=3,(AJ6-3)*AN6+(3*AK6))+IF(AJ6>=3,(AH6-AJ6)*AI6)+IF(AJ6=3 - in the first instance I need a 0 recorded if cell AJ6> cell AH6
    - should that not be the case then I need the following calculation to take place (cell AH6 - cellAJ6)*cell AI6 (where cells AH & AJ are hours worked & cell AI is a rate of pay.

    My many attempts have been close but do not seem to recognise the IF/OR component - I need this because if it calculates a negative number as it can in the first instance it decreases the pay of my employees.

    Can someone out there help me?

  14. Hi, please help in my formula. I only get the first part right. If cell AB=1/2/3/4, returns 'Closed', else 'Open'. And if cell AB=#value!, returns Open.
    This is the formula I am using right now.
    =IF(OR(AND(AB3=1),AND(AB3=2),AND(AB3=3),AND(AB3=4)),"Closed","Open")
    Thanks a lot for ur help.

  15. Hello
    I need help to output the following:
    if given a list of id numbers and the 5th number represents sex i.e 1=male 2=female
    which formula can I use to find the sex
    eg given the following IDS:
    001329876
    123415672

    1. Hello, Gofa,

      the formula below should help:
      =IF(RIGHT(LEFT(A1,5),1)="1","male","female")

      Feel free to take a look at this article to learn what LEFT function does, how it works.
      Hope this helps!

  16. Hi, Please help me in this senario.

    If there is a data (String) in "A2" need to compare with a range of cells say F1:F20. How can we compare using IF condition, or pls suggest me other possibilities.

    Regards,
    Varun.

  17. Hi,

    here's my formula right now:
    =FLOOR(MAX(C19,G19), 0.125)+$K$8

    what I want to do is that, i want to add an IF that if C19 and G19 are the same value, the formula will automatically deducts 5 from G19.

    any help will be much appreciated.

    Thank you

    1. Hi, Leo,

      if I understand your task correctly, the following formula should help:
      =FLOOR(MAX(C19,IF(C19=G19,G19-5,G19)),0.125)+$K$8

      Hope this is what you need!

  18. Hi Ablebits.com Team,

    I am looking for help what kind of formula to resolve this condition.

    When A1= coal and B1= coal, then assign as coal
    however, when A1= coal and B1= 0, then assign as 0

    1. Hi, Daniel,

      you need to create a nested IF formula with AND logic in it:
      =IF(AND(A1="coal",B1="coal"),"coal",IF(AND(A1="coal",B1=0),0,""))

      Please note that if neither of these conditions are met, the cell with the formula will remain empty.

  19. Hi Ablebits.com Team

    I am looking FOR help with formula for the following condition:

    When A1 B1 AND C1=D1 AND A10 AND B10, then assign E1 value "5065"
    When A1 B1 AND C1=D1 AND A1=0 AND B10, then assign E1 value "5065"
    When A1 B1 AND C1=D1 AND A10 AND B1=0, then assign E1 value "5066"
    When ABS A1 = ABS B1 AND C1D1, then assign E1 value "5067"

    THANKS.

  20. Hello, hope you can help!

    I have a column(A) with a drop-down menu with 7 different options ('Meeting', 'Private Party. 'Weddings', etc)That run on a calendar year.

    I have another tab where I have each option in a column (B), and next to it (C), I would like to have the total numbers of 'meeting', 'Party', 'Weddings' (from column A) within that Year (So a total SUM)

    How can I use the Sun formulas for a Word variable?

    does this make sense?

    1. Hello, Zsofia,

      I believe you could use the following formulas to count the words:
      =COUNTIF(A:A,"Meeting")
      =COUNTIF(A:A,"Private Party")

      and so on.

      Please check out this article of ours to learn how COUNTIF works.

  21. I need help with a formula.
    I have a list of individual names some duplicate names. The duplicate names have test scores which I need to see if the score increased or decreased by when they took the test which is by date.
    How can i make a formula to look for multiple last names then look by date and score to get a result of increased +20 or decreased-20
    Example:

    Smith 200 9/25/2017
    Smith 175 9/1/2017

    Jones 150 9/24/2017
    Jones 180 9/1/2017

    I would appreciate if anyone knows how I can do this.

  22. I was wondering if anyone could help me out with an if statement.

    I have a figure in cell B5 I want to run an IF/OR statement on it to do the following:

    If B5 <5 then use the value in X5, OR if B5 = 5 AND 10, then use the value in X7

    Any help would be appreciated.

    1. Hi, use the below Formula i think it will work

      =IF(B5<5,X5,IF(OR(B5=5,B5=10),X7,""))

  23. Was hoping you could help me? Here is my current formula:
    =IF(ISNUMBER(E15),VLOOKUP(E15,ReferenceTables!$B$13:$C$26,2)-F15,"0")

    Now I'd like to add "IF H15, I15 or J15 show any text, reduce this number by one"

    Thanks!

    1. Hello, Josh,

      for us to be able to assist you better, please describe in more detail the last part of your condition with the text in H15, I15 and J15.

      If you still need help with this formula, it would be better if you could send us a small sample workbook with the data and the result you expect to get to support@ablebits.com. I kindly ask you to shorten your table to 10-20 rows.
      Don't forget to include the link to this comment.

      Our tech specialist will take a look at your task and try to help.

  24. Dear All,

    scenario as below.
    Price
    A1 B1
    1 YES
    2
    3
    4
    5
    i want to use formula wherein B1 Column populate automatically as "YES" to which the lower price is.

    Please help

    1. HI, IF(A1<=1,"YES","")

  25. dear sir/madam,
    i want to use IF function to come up with a formulae that will be giving me selling price basing on the below markup(in percentage);

    1)100≤Price of item ≥0 = 172.5%
    2)500 ≤ Price of item≥101 =137.5%
    3)5,000≤price of item≥501=77.5%
    4)20,000≤price of item≥5,001=57.5%
    5)40,000≤price of item≥20,001=77.5%
    6)100,000≤price of item≥40,001=37.5%
    7)Price of an item ≥100,001 =17.5%
    i want an excel sheet where i will be inserting the invoiced amount and the column with the formulae give me the selling price.

    thanks in advance.

    regards
    george

  26. =IF(C12<100,C12<200,C12<500,"C12*1,C12*1.5,C12*2")

  27. Hello,
    I'm trying to use if formula based upon Text value in a cell, but wanna use another 2 different if formula (for aging bucket based upon value of different column) based upon text matches or not.
    but unable to run it, anyone please help me

    =IF(OR(L2="GDC","=IF(J2<=7,"0-7 days",IF(J2<=30,"8-30 days",IF(J2<=45,"31-45 days",IF(J2<=60,"46-60 days",IF(J2<=90,"61-90 days",IF(J2<=180,"91-180 days",IF(J2<=365,"181-365 days","365+ days")))))))","=IF(J2<=2,"0-2 days",IF(J2<=5,"3-5 days",IF(J2 15 ")))"))

  28. Hi,

    I am trying to pull a number based on the input.

    IF(B24510030045, then result should be as C27 & B2 valus is >100<299 then C27...

    Can anyone help me to solve the issue for me..Thanks in advacne

    1. Hi,

      I am trying to pull a number based on the input.

      =IF(B245100300500,C6)))) IF the input value is B2 = 5 then result should be as C2 & B2 value is >100<299 then C4...

      Can anyone help me to solve the issue for me..Thanks in advance

  29. can someone help, looking for formula to yes or no if number in cell C1 is greater than or equal to 3 of number in cell B1.

  30. hi

    i want to know how to use Round function to the below formula

    =round(IF(G2<60,'Export Worksheet'!AD2*5%/365*G2,IF(G2<120,'Export Worksheet'!AD2*10%/365*G2,IF(G2<180,'Export Worksheet'!AD2*15%/365*G2))))

  31. can I get a formula to generate a pattern like this
    1
    1
    2
    2
    3
    3
    4
    4
    5
    5
    and so on.......

  32. Hi,

    I was hoping to get some help with my formula below:

    My cell E32 is interchangeable, could be 50, 45, 32, 0, e.t.c. I want the returned value to be in two (2) decimal place if condition is met in the formula. instead of just displaying 1, 2, 3, 4,5 in my formula it should give me exact value in 1 or 2 decimal places. i tried to add .0 to the formula but eachtime it keeps disappearing.

    =IF(AND(E32>0,E322.2,E324.4,E326.6,E328.8,E32<=11),5,"Out of Range")))))

    Thanks

    1. Sorry see correct formula:

      =IF(AND(E32>0,E322.2,E324.4,E326.6,E328.8,E32<=11),5,"Out of Range")))))

  33. Hello,
    I am trying to compare a date in C2 and if equal to a range of dates in another row =IF(C2=D5:D10,1,0)

  34. Hello.
    I want to use IF function, but dont it.
    For exmp.
    IF B4=1,B4=2,B4=3,B4=4 "BAD"
    IF B4=5,B4=6,B4=7,B4=8 "GOOD"
    IF B4=9,B4=10,B4=11,B4=12 "OK"
    IF B4=13 "SUPER"

  35. Thanks again

  36. Hi friends,

    kindly guide me for solve the problem i.e. "i need answer of a employee attendance it is in excel sheet that have P for present and .75 is leave of 1/4 and .5 is half day how can i solve it ?

    Lokendra Sahu P L P P P P P P L P 0.75 P 0.50 P P L P P P P P P L P P P P P P L P 24 7.00 0 31

  37. I have a cell (say A1) contain values like this format:0.453, 0.583, 0.383. I want to get each number from cell and compare if they are > 1. And I write this for 1st number(0.453): =IF(LEFT(A1,5)>1, 1, 0)
    It return 1 which is not correct. I check "LEFT(A1,5)>1" can return 0.453. Thanks for your advice.

  38. I have the operation like this:
    =if(A1=8,50,"")

    What will i do if i will add the operation like A1 =0,0

    How do i include that on my operation. Thanks thanks

  39. i have to calculate overtime data

    OE Names Orders Processed Target Extra Orders
    Amit Singh 38 40 -2

    Now i only want to pay overtime if my team members have met the target and they can get the overtime paid for whatever extra orders they have processed else the variance cell should indicate 0 for not having earned any overtime.

  40. Hello,
    I'm using excel 2010.
    In cell D2 is a date. F.e. 07/08/2017
    In cell G2 is a value F.e. 38
    I would like to use a formula in cell I2, which will give me the value from cell G2, if the date in cell D2 is greater or equal than 28/08/2017.. I am currently using the formula: IF(D228/08/2017;G2;IF(D2<28/08/2017;""))
    So normally in my example, the outcome should be "" because the date in cell D2 is smaller than 28/08/2017 but it doesn't...

      1. Natalia,

        I have been struggling with date ranges within IF formulas, but your response to Glenn helped me greatly. Many thanks.

  41. I have used a simple IF statement to identify Pass/Fail conditions.

    IF(I4>1, "FAIL", "PASS"). As long as I4 contains actual results, this works fine.

    But sometimes there is text in I4 (see note, etc.). Since the text is not >1, the result should be PASS, but I'm getting FAIL.

    So I turned it around: IF(I4<=1, "PASS", "FAIL"), but the results are the same, FAIL when there's text in I4.

    Can you explain this?

    (Still) using Excel 2003 (I hate the ribbons).

    Thanks

    1. Hi,

      You need an additional condition that will check if the values in I4 is number. Please try the formula below:
      =IF(AND(ISNUMBER(I4),I4>1),"FAIL","PASS")

      You can read here how AND logic is used in formulas.
      Hope this helps.

  42. Hi

    I have value in a cell(A1) like "01-USA" (This is fixed Cell Value)
    Another Cell(A2) value is changing as per country selection but sometimes value comes same as in fixed cell. Please note both cells have text value only.
    so I want following results

    If A2 value is same as A1 then result like 10-5 =5
    If A2(02--Canada) value is different from A1(01-USA) then result must be Blank

    Thanks in advance for your help.

    1. Hi, Surya,

      as far as I can see, you have all the conditions to build a nested IF. Please check this tutorial to learn how it's made. There are lots of examples as well.

      Also, in case you don't know how to show if the values are not equal, I'd recommend you to look through this article as well.

      Hope these pieces of info will help you solve the task.

  43. Hi Sveltalana ,
    I have 2 cells with dates(A2, B2) , i would like B2 to highlight if it is larger than 180 days / 6 months than cell A2

  44. what would be the formula

    if the sum total in C10 is less than or equal to 300 the cell should show 300 but if C10 is greater than 300 then it should pick the C10 value.

    can you help me in this

  45. I am trying to produce a number in a cell.

    The number must come from column F when then column C and column N match a specific text.

    The formula I have tried only give FALSE results.

    =IF(AND('Sheet1'C:C="XYZ", 'Sheet1'!N:N="ABC"), 'Sheet1'!F:F, "N/A")

    Any help would be appreciated.

    1. Hello, David,

      I'm afraid this formula won't work like this.

      If you need to return only one number from each F cell, you need to use a separate formula for each separate cell, like:
      =IF(AND(‘Sheet1’C2=”XYZ”, ‘Sheet1’!N2=”ABC”), ‘Sheet1’!F2, “N/A”)
      (you can place the formula into one cell, and copy it down the column)

      Ii you need to perform some mathematical operation with the found values, you need to enclose the whole IF formula into COUNT, or SUM, or AVERAGE, or some other function depending on the operation you need. In this case it is an array formula. It is entered by pressing Ctrl+Shift+Enter on your keyboard instead of just Enter.

      Hope this helps!

  46. Hi,
    I have a workbook consisting of two worksheets.
    On worksheet one I record who has taken what showing quantity and sizes.
    On worksheet two I am keeping a usage report of those same items handed to numerous contractors(stock, ppe etc) showing size and quantity usage.
    I want a formula put on w/s 2 cell Q4 that if on worksheet 1 in block C4 the value is "S" then the value of q4 must be the same as the value in D4 on w/s 1.
    Can you help please.
    Thanks
    Emcee

  47. Hi, I have a problem while using IF function.

    IAm trying to use if function Column B & C with a formula that if column B contains CLOSED than C should be CURRENT date and the formula is " =IF(B2="CLOSED",TODAY(),"") ".

    It is working correctly, however, while opening the excel sheet in the next day, it is reflecting the current day and it is not reflecting the date which I actually enter CLOSED in column B on the particular date.

    Can someone please help me to fix, what exactly am I doing wrong here?

    Thanks,
    Paddy

  48. Hi,

    I was looking at doing a formula like the below;

    =IF(ISNUMBER(SEARCH(”P”,D19,3)),(VLOOKUP(D19,'Rates Summary '!A$2:Q$1573,2,0)),D19)

    Basically, I have a code "QAPLI0" in cell D19. What i want to do is convert this to a QAR code which is what my Vlookup is for. Only problem is that when i already have a QAR code in the cell D19 it still brings me back a QAP instead of leaving it was whats already in the cell D19 which is what i though i had down as the "value if false" part of the IF statement.

    Am i making sense? I tried to use a FIND instead of SEARCH but got the same result. Am i missing something here?

    Any help would be great.

    Thanks
    Jon

    1. Hi, John,

      Please note that you have smart quotes instead of double ones in SEARCH(”P”
      If this is the way the formula is written in Excel, ISNUMBER will always return false.
      Also, ’Rates Summary ‘ has space at the end.

      If this doesn't solve your problem, please send us your workbook to take a look at to support@ablebits.com. Please don't worry if you have confidential information there, we never disclose the data we get from our customers and delete it as soon as the problem is resolved.

  49. So I am trying to make a call schedule for my work and am having trouble creating a formula that will help me. What I am looking to do is have the Initial Call date (A) and a column for the call back date (B). I want excel to fill in the call back date for me (B) for a certain length of time per my customers buying level.
    Ex: If customer is "gold level" (C) and the initial call date (A) is 1/1/2017 then call back in 30 days or 1 month (2/1/2017) (B) or,
    If customer is "silver level" (C) and the initial call date (A) is 1/1/2017 then call back in 60 days or 2 months (3/1/2017) (B).
    Can this be done? Thanks for the help!

  50. For one of our lab tests, we take 2 weights. The second can't be more than 0.4 away from the first. If it is, then we have to do a third weight. I need the "residue" cell to calculate depending on that. If the second weight is within 0.4, I need it to use that. If not, there will be a third weight entered, and I need the "residue" cell to calculate based on that one. Can anyone help?!?

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