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 56. Total comments: 4813

  1. Hi,

    Need make a If statement where, if the cell is blank it should return 'X' cells value and if the cells alphanumeric character length is 12 it should return 'X' cells value.

    1. Hello,

      If I understand your task correctly, please try the following formula:

      =IF(ISBLANK(A1),B1,IF(LEN(A1)=12,C1))

      Hope this will work for you

      1. Thank You Gennady, yes the formula works.

  2. I need to make an IF statement where one column is the expiration date and one is the current date and If the expiration date is 10 days less than the current date, then the expiration date cell will turn red. Any help would be appreciated. Thank you.

    1. Hello,

      Supposing that the expiration date is in column A, please try to do the following:

      1. Select cells with your data.
      3. Click Conditional Formatting -> New Rule.
      4. Select the "Use a formula to determine which cells to format".
      5. In the Formula field type the following formula:
      =TODAY()-A1<=10
      6. Click the Format button to set the format you need.
      7. Click OK.

      We have an article on our blog that describes how to use conditional formatting in Excel. Please have a look at it.

      Hope it will help you.

  3. I am doing a budget spreadsheet. I have column C as what I spent my money on with drop down menus (Alcohol, Food, Gas, etc.). Column D is how much I spent. I would like Column I to be the totals of each item in the drop down list. Example: If it says Alcohol in column C then add all the numbers in column D that coincide with Alcohol.
    Alcohol 20.00 Alcohol 40.00
    Gas 44.00 Gas 88.00
    Food 100.00 Food 400.00
    Alcohol 20.00
    Gas 44.00
    Food 100.00
    Food 100.00
    Food 100.00

    1. Hello,

      For me to understand the problem better, please send me a small sample workbook with your source data and the result you expect to get 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.
      Please also don't forget to include the link to this comment into your email.

      I'll look into your task and try to help.

  4. Can someone help me with a formula
    if a purchase is $500 or more they can make the first payment in 180 days otherwise if less than $500 they make the first payment in 30 days. the result needs to show the new payment date

    1. Hello,

      Please try the following formula:

      =TEXT(IF(A1<500,B1+30,B1+180),"mm/dd/yyyyy")

      where cell B1 contains a date value, e. g. 1/30/2018

      Hope it will help you.

  5. Hi,

    I've a situation where I have 4 cells to enter data in which If I enter data in Cell A then either B, C or D should have some entries or any of them should have entries. Can you please help me with this logic.

    Thanks
    Ramakrishna

    1. Hello,

      Please create a custom Data Validation rule for cell A1 using this formula:

      =OR(NOT(ISBLANK(B1)),NOT(ISBLANK(C1)),NOT(ISBLANK(D1)))

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

      Hope it will help you.

  6. Hello,

    Can you please help me with a formula for a situation below.

    I have a column A with list of info (e.g. a-z), I want the second column (Column B) be such that if the text in column A matches/or contains the same text as Column C, then one value; if the text in column A matches/contains same text as Column D, another value, if the text in column A matches/contains same text as Column E, another value, and so on.

    Thanks you!

  7. hello, i got some problem in use of excel formulas,

    1 form=13.33 rs
    2 form=26.66 rs
    3 form=39.99 rs
    4 form=53.32 rs
    5 form=66.65 rs
    6 form=79.98 rs
    7 form=93.31 rs
    8 form=106.64 rs
    9 form=119.97 rs
    10 form=133.3 rs

    i want such type of formula that gives mi the proper value which i mentioned, by the typing of only value of no. of forms

  8. Hi. Good day!

    What would be the formula I can use for the details below.

    if Column A is "Corporate A", then amount is 25,000;
    if Column B is "Corporate B", then amount is 55,000;
    if Column A is "Academe", then amount is 15,000;
    if Column A is "Individuval/Startup", then amount is 5,000;
    if Column A is "Support Sector", then amount is 60,000.

    Your help will be much appreciated. Thanks!

    1. Hello,

      Please try the following formula:

      =IFS(A1="Corporate A",25000,B1="Corporate B",55000,A1="Academe",15000,A1="Individuval/Startup",5000,A1="Support Sector",60000)

      Hope it will help you.

  9. Hey! I am trying to write an IF FUNCTION that will take the value of a cell in a table in the cell before equals a specific word. (I hope this makes sense)

    Example: If C4 has the word "ESSENTIAL" within the cell, that I want D4 to be copied into another cell.

    The plan is to track spending, on specific items, based on how they are catagorized. Then put all the ones that are catagorized into a new table with a sum for that catagory.

    Hope this makes sense

  10. Hi want to ask if a have an array of data, each of my samples have a row of value (few column of descriptive value). and I want to use IFBLANK() to check the each of the row to give it a "complete"(if all are filled) or "incomplete" (if it got any empty cells in the row) data.

    How do i do it? IFBLANK(C2:X2) for example, it just gave "false" to the row but it still has an empty cell.

    1. Hello,

      Please try the following formula:

      =IF(SUMPRODUCT(ISBLANK(C2:X2)*1)>0,"blank","non-blank")

      Hope it will help you.

  11. In excel, my cell contains either x or y text. If text is x, then I need to put multiplication of three cells and if y, then need to put multiplication of other three different cells. how to put formula in the cell?

  12. EX:1
    A
    -10
    0
    IF(A1=0," ",)

    help to us..

  13. I am having trouble finding a formula for defining the payment deadline for invoices.
    If the invoice is dated before the 15 of a month it should be paid by the 15th of the following month, otherwise it should be paid before the 30th of the following month.
    I've tried combining IF with DATE but it returns the formula as text...

    1. Hello, Mara,

      Please try the following formula:

      =DATE(YEAR(EOMONTH(A1,1)), MONTH(EOMONTH(A1,1)), DAY(IF(DAY(A1)<15,15,EOMONTH(A1,1))))

      Hope it will help you.

  14. I have an excel document with three columns.

    Example; I have the Name of staff, Amount contributed (deposit), amount applied from loan. I want to insert another collumn to analyze how many have qualified to receive the loan. I the new collumn, I want to introduce clients who have paid the required deposit( qualification amount and bring in the new collunm the amount of loan applied. Eg If qualification amount is $500,and the clients has applied a loan of $100000, i want the $100000 to appear in the new collumn by use of the formullae.

    1. Hello,

      For me to understand the problem better, please send me a small sample workbook with your source data and the result you expect to get 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.
      Please also don't forget to include the link to this comment into your email.

      I'll look into your task and try to help.

  15. I need to have a formula for the following; exp, column D, if b1=1, then enter vc; if b1=2, then enter vce if b1=3, then enter pp, and so on up to #5
    thank you so very much for helping me

    1. Hello, Wanda,

      Please try the following formula:

      =IFS(B1=1,"vc",B1=2,"vce",B1=3,"pp",B1=4,"value4",B1=5,"value5")

      Hope it will help you.

  16. Hi. I have a question on the IF logic: state the status in a column as COSTLY if total expense is above $20,000, or FAIR if total expense is less than $20,000 but greater than $10,000, or MAINTAIN if total expenses is below $10,000

    1. our value in A1 cell

      =IF(A1="","",IF(A110000,A120000,"Costly"))))

  17. Hello, I am trying to get a cell AB3 to show "complete" and if not to show "pending" when Cells on the spreadsheet H3,N3,T3, and Z3 are all showing "complete". I do not have the slightest idea how to write the "IF" formula.

    Any suggestions are appreciated greatly!

    1. If(and(H3="COMPLETE",N3="COMPLETE=,T3="COMPLETE",Z3="COMPLETE"),"complete","pending")

      I done by mobile but its correct check

  18. In cell A cell B
    apple 1x
    grape 1x
    strawberry 1x
    grape 2x
    melon 1x
    grape 3x
    what function do i need to complete my cell B automatically
    tq....

    1. Hello,

      I'm afraid there's no easy way to solve your task with a formula. Using a VBA macro would be the best option here.

      However, since we do not cover the programming area (VBA-related questions), I can advice you to try and look for the solution in VBA sections on mrexcel.com or excelforum.com.

      Sorry I can't assist you better.

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

  20. 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!

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

  22. 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? :)

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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