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

  1. hi i have query please solve it

    A B
    1 DATA REQUIRED ANSWER
    2 1 2,3,4
    3 5 6,7
    4 8 9,10,11
    5 12 13,14,15
    6 16 17
    7 18 19
    8 20

  2. I want to make formula where for e.g. IF A1 = 660, and I want if A1/60 i.e. 11 is greater than 3 then it should Multiple A1 with 100

    Here I took UNIT type of 600 as "Seconds" if it is more than 3 minutes after dividing by 60 (please Remember) then A1 should multiplied by 100 else the result should be ZERO.

  3. hi,

    could you please some help me this formula?

    Average of 24 units is equal to or greater than Q, not more than 2 units are less than Q − 15%, and no unit is less than Q − 25%

    Q value= 80%

  4. hi, can someone help me with this formula? I am making an if/or furmula showing that if the service years>3 or is a college graduate the column will be a yes. (only one condition needs to be met) I have:

    =IF(OR([@[College Graduate]]="Yes")([@[Service Years]]>3,"Yes","No")

    thanks.

    1. Hi Jordan,

      The correct syntax of the IF/OR formula is this:

      =IF(OR(condition 1, condition 2), value_if_true, value_if_false)

      In your case:

      =IF(OR([@[College Graduate]]="Yes", [@[Service Years]]>3),"Yes","No")

  5. How decimal numbers can be compared?

    =IF(A1>2.34,"A","B")

    If A1=2.21, it shows B

  6. Hello,

    I see all you are very supportive, Pls help to solve this.
    i have a data,

    Column A Column B Column C Column D Column E
    FFA Exp Gain 1 Gain 2 Evoporate

    1 125 98% 1% 1%
    2 200 96% 2.5% 1.5%
    3 235 95% 3% 2%
    4 345 93% 5% 2%
    5 430 92% 5.5% 2%
    6 510 90% 8% 1%
    7 740 87% 10% 2%

    so on

    i want when i enter 1,2,3..... in a box my below mention results from above data shows to me, is it possible???

    Exp 125
    Gain 1 98%
    Gain 2 1%
    Evoporate 1%

    Regards,

  7. Hi,

    I want to use if function for a data entry purpose. I want it as if a particular column contains a particular name the very next cell should mention the city of the particular person's name.
    Eg:

    if the column contains the name Kumar his city Bombay should appear just next to his name.

    Please help.

    Thanks in advance

  8. I need to verify dates. I need column a and b to be the same if they are not I need to distinguish. How would I create this formula?

    Please help!

  9. hi

    i have this table

    m1 width m2
    330

    I want to calculate from m1 to m2 and viceversa. Is it possible to do that in the same cells?

  10. i need to validate a cell. The cell will contain values from 1-10. 1-6 the values will be considered not at all likely 7 and 8 will be neutral and 9 and 10 will be considered as extremely likely. Can you please help me with an if loop formula ?

  11. "Monthly Grand Total(Minus Applicable Discount)-The sum of all campaign cost for each month, including postage, envelops and messaging cost. If a high volume discount is applicable, it should be calculated here as well. Keep in mind two conditions must be met before the discount can be calculated: The discount threshold must be greater than zero and the yearly total mail volume value must be greater than the threshold"
    Can you tell me the formula for this, please?

  12. Hi

    please share if function the below mentioned query

    Salary and Wage earners-Such persons whose
    monthly
    salaries or wages :-
    (a) do not exceed rupees 7,500; NIL
    (b) (i) In case of male, exceed Rs. 7,500 but do not
    exceed rupees 10,000;175 per month
    (ii) In case of female, do not exceed Rs 10,000; Nil
    (c) exceeds rupees 10,000 2,500 per annum

  13. I am trying to evaluate a date in the previous cell. If the date is before the 15th of the month I wan the evaluation cell to return the first of the month. If it is equal to or greater than the 16th of the month, I want the evaluation cell to return the 15 of that month. Examples:

    Cell A Date Cell B Returns
    10/8/16 10/1/16
    10/16/16 10/15/16
    11/3/16 11/1/16
    11/22/16 11/15/16

    Any thoughts or suggestions are really appreciated!!!

    Charles

    1. Hello Charles,

      Try the following formula, where A2 is the date in the "previous cell":

      =IF(DAY(A2)<16, DATE(YEAR(A2), MONTH(A2), 1), DATE(YEAR(A2), MONTH(A2), 15))

    2. Hi Charles,

      Here You Go,(Paste in B1)

      IF(DATE(YEAR(A1),MONTH(A1),DAY(A1))=DATE(YEAR(A1),MONTH(A1),"16"),DATE(YEAR(A1),MONTH(A1),"15")))

  14. This might sound simple but I'm not as bright as I'd like to think. if j48 = 9 then 10, if j48 = 10 then 9. please help

    1. Hi George,

      You can use a couple of nested if's like this:

      =IF(J48=9, 10, IF(J48=10, 9, ""))

  15. In Col I Write a formula to give rank to student In Col I Write a formula to give rank to student based on below table (Without using IF Condition)

    Marks Grades
    =33 but less than 60 Pass
    >= 60 but less than 70 3rd Div
    >=70 but less than 80 2nd Div
    >=80 but less than 90 1st Div
    >=90 Distinction

    based on below table (Without using IF Condition)

    Marks Grades
    =33 but less than 60 Pass
    >= 60 but less than 70 3rd Div
    >=70 but less than 80 2nd Div
    >=80 but less than 90 1st Div
    >=90 Distinction

  16. Hi, I wish to use the sumif the range cell data as follow, it is that possible?
    If(A1=B1,C1,0),
    (A2=B2,C2,0),
    (A3=B3,C3,0),.....
    AND I would like the sum of range cell in column C

    All in one formula, is that possible?

  17. I want to say: if a certain cell equals a value and another cell equals a value then use this value

    Ps. above values are txt not numbers.

    what I got so far is IF((B19="General Trading", B20="One Payment"),"27,185","")

    but it isn't working.

    Please help me

    1. Hello Mahmoud,

      You have to use an AND statement, like this:
      =IF(AND(B19="General Trading", B20="One Payment"), "27,185", "")

  18. hi,I want to use the if function like

    if the A1 is starting with s, then I1 is equal to B1-C1+D1-E1+F1-G1
    if the A1 is starting with m, then J1 is equal to B1-C1+D1-E1+F1-G1
    if the A1 is starting with z, then K1 is equal to B1-C1+D1-E1+F1-G1

    pls help me with this formula, thanks

  19. Hi I am a basic excel user, I am using excel 2016, my question is:

    I am using the formula =IF(X4030="",TODAY()-W4030) to get the result but if the cell W4030 is blank the result is some strange value, I want excel to display nothing if the cell W4030 is blank, how can i fix this. Please help. Many Thanks

    1. Hi Syed,

      Try this one:

      =IF(X4030<>"",TODAY()-W4030, "")

  20. Hi, Svetlana,

    I would appreciate it if you could help me with this

    I am trying to display contents of a table T1 if value of D2 is BAT

    in a Cell E2 =IF((D2="BAT"),T1,"")
    but it gives #value! error. How can I display the table T1?

    T1 table is made up of G7:I11 cells.

    Looking forward to hearing from you

    Thanks in advanced.

    Warm Regards,
    Vilas.

    1. Hi Vilas,

      The IF function cannot display the contents of an entire table in a single cell. You can write a formula to extract the data from the upper-left cell of your table, and then copy the formula to an empty range containing the same number of rows and columns as your table does to pull the values from other cells. For example: =IF(D2="BAT", T1, "") Where T1 is the left-most cell of the table.

  21. Hi,

    I have some values in column A(row1:row10) and column B(row1:row5). I need to compare column A values with column B, if any matches means, I need that value in column C.

    Example:

    Column A Column B Column C

    1 5 1
    2 6 2
    3 1
    4 2
    5 8 5
    6
    7
    8 8
    9
    10

    Pls give me the formula to perform above operation

  22. Hi There,

    I want to create a multiple formula as follows:
    =IF(D3=1,16000000,IF(D3=2,12000000,IF(D3=3,5000000,3000000)))

    But, it doesn't work on my Excel 2013. Is there something wrong with the formula?

    Please advise.
    Thanks.

  23. columnA ColumnB
    mango fruit
    apple fruit
    orange fruit
    pepper spice
    salt spice

    How do I input a formula under columnB to have answer either fruit or spice?

  24. i want to formula for whose name or spell starting or includes in name e.g. s the name selected.

    such as suman,sumit ,hans,kiss, then what is the formula for takeing all.

  25. Teacher 1 02:10:05 history
    Teacher 2 09:12:12 social
    Teacher 2 01:12:12 math
    Teacher 2 00:12:12 physics
    Teacher 4 06:12:12 chemistry
    Teacher 2 09:12:12 evs
    Teacher 1 07:12:12 robotics
    Teacher 2 06:12:12 syc
    Teacher 2 02:12:12 health
    Teacher 2 09:12:12 geo
    Teacher 3 02:12:12 indian his
    Teacher 3 01:12:12 french revo
    Teacher 3 01:12:12 language

    here i need to add all the value of the teacher 1.

    i.e., if "teacher 1" is true then it has to display "history,robotics"

    i use the =COUNTIF(A1:A13,"teacher 1") to count the entry of user (teachers)

    and

    i use =SUMPRODUCT(--(A1:A13="teacher 1"),B1:B13) to find the some of the product of an user (teacher)

    and i need your help for the top most "to add all the value of the teacher 1"

  26. All provided learning about excel is very helpful. Thank you Svetlana & team

  27. Hi,
    I want to to create an IF function where the true value will equal the text in a given cell from another sheet. Is it possible to set up?

    thanks

    1. Hello BETHAN,

      Sure, you can do that. For example:
      =IF(1=1, Sheet2!A1, "")

  28. Hi want to get
    if i entered yes in A1,then it should return value 5 in B1,and if i entered NO in A1,then it should return value 0 in B1, is it possible to impelement.Please help me

    1. Hi Anish,

      Here is the formula for B1:

      =IF(A1="yes", 5, IF(A1="no", 0, ""))

  29. Dear Madam,

    i have a cell for date and need to check the month and another cell will appear text according to the month. Example:

    Jan = Cohort 1
    Feb = Cohort 2

    A1 = 5-Jan-2015 and i want A2 to be equal to Cohort 1

    what is the formula for A2 ?

    Thank u in advance!

  30. hi, I need to replace a cell by searching another cell when contain a specific text, would you please help me to know if it is possible or not?

  31. How do I write this in the "if function" If the Quantity in Stock is less than 50, then the cell should display Order. If not, then the cell should display Ok

  32. how to find cell position in selected area or specifica area
    a b c d
    1
    2 b2
    3
    4 a4 4d

    like this

  33. i m using this formula but it working only till two slabs......

    =IF(I15=90,"120",IF(I15>=100,"124",IF(I15>=125,"130",IF(I15>150,140,IF(I15>175,142.5,IF(I15>225,143,IF(I15>250,144))))))))

  34. Dear Sir/ Madam,

    I have a rate slab.
    how i use slab by if function??? Plz Help

    KG Rate
    90 below 100.00
    90 up 120.00
    100 up 124.00
    125 up 130.00
    150 up 140.00
    175 up 142.50
    200 up 142.50
    225 up 143.00
    250 up 144.00

  35. I have a data set where i have to find if a date is between 1 March 2016 to August 2016) and if they are then yes, else No.

    1. Hello Kevin,

      You can use a formula similar to this:

      =IF(AND(A1>DATEVALUE("3/1/2016"), A1

  36. My university boards horses. Monthly boarding fees are due the 3rd day of the month for the current month -- for example, for September, fees were due September 3rd. If they pay after that date, we charge them $5 a day until the 15th, for a possible total of $60.

    I would like to create a formula that will calculate how much they owe if they pay late. For example, if a person paid on September 6, they would owe $15.

    I think I can do an IF function incorporating DATEVALUE. When I tried it with the September 6 example above, I got $55 instead of $15.

    Here is part of the formula I used:

    =IF(O6DATEVALUE("9/4/2016"),5,0)+IF(O6DATEVALUE("9/5/2016"),5,0)

    which continued with the dates to 9/15/16.

  37. I need a formula that will replace the 'YES' or 'NO' with a number as I want to use this formula
    =75+(A1*3) but if that number is below 125 I want it to automatically default to 125.
    Any idea how to do this?

    I also want to be able to do this without adding an additional column?

    Thanks

  38. Hi,

    I need a cell in lets say Column A = a cell in Column B.
    It's a Reference number like this 2016SEP15-1 that needs to appear in Column B as I type it in Column A.

    As what do I set those two Cells? TEXT or GENERAL?
    How do I get them to relate or equal?

    I hope I've described it well.

    Thanks

  39. I have three set of numbers, I want the cell to tell me which on is greater by using 3,2,1.

    Example

    80 3
    50 2
    10 1

    To give me the order my the 3, 2, 1.

  40. Hi this formula correct, pls advive

    =IF(COUNTIF(P112:P133,)=_T110,(T112*0.07))*(1+$I$1)

  41. Hi
    If D5:D12 contains an X I need this to link to another sheet to show as the value of 20. I am trying to link a sheet with ticks/crosses to show the selection with a sheet that then gives these a numerical value

  42. I am a basic coder.I want to know if my cell contains any"text" and I want to take some value from another cell. Is it any Way to do that.

    example=IF(T2="text",pic value from E2)

  43. I am using the following Countifs formula:

    =COUNTIFS(C1:C200,A2,D1:D200,B1)

    The data in columns C and D are text (not numbers).

    This formula generates a zero for those that do not meet this criteria, but I would like it to display nothing (be blank) instead of displaying a zero. Is it possible to do this? THANKS!

  44. I need help formatting a pivot with labels that were not properly repeated prior to emailing it to me.

    Column C2 has a store name and column C12 has a different store name

    =If(C3="",C2,if(c4=c3,c3,___)

    But how to I get it to pick up a different store name without having to lock cell C2? My goal is to formulate this down a spreadsheet of 5,000 lines.

    Is this possible to help with my formatting?

  45. Which Formula Use In This Condition If "This=This=This==True"

  46. Hi Svetlana Cheusheva,
    Your posts helps me a lot in excel and today I am stuck in a situation. Situation is:
    In C:C column I have the codes (BR, DHN, RS, AN and so on), in F:F column I have the months number (6, 7, 10 and so on) and in I:I column fee is mentioned (2500, 4200, 3500 and so on).
    Now I wish to apply a formula in column J2, that whenever there is a code "BR" is mentioned in column C:C then it automatically multiplies the values in column F:F and I:I against the mentioned code and then gives me the sum of total value that will be generated by multiplying the different values in column F:F and I:I.
    If you can help me out.
    Regards
    Abatis

  47. Hi Svetlana Cheusheva,
    Your posts helps me a lot in excel and today I am stuck in a situation. Situation is:
    In C:C column I have the codes (BR, DHN, RS, AN and so on), in F:F column I have the months number (6, 7, 10 and so on) and in I:I column fee is mentioned (2500, 4200, 3500 and so on).
    Now I wish to apply a formula in column J2, that whenever there is a code "BR" is mentioned in column C:C then it automatically multiplies the values in column F:F and I:I against the mentioned code and then gives me the sum of total value that will be generated by multiplying the different values in column F:F and I:I.
    If you can help me out.
    Regards
    Absti

  48. if i want to do something like this then
    1 = 350 then when i type 20 value should go to 700

  49. Col A Col B Col C Col D Col E
    FAIL Total Accuracy
    Account XXX 2 2 =IF(OR(B1="pass","fail"), B2/C2,C2/D2)

    anyone, please help for me to get accuracy calculation in column e
    column b, sometimes pass or fail since this is pivot

  50. I am using a drop down box
    what i am trying to achieve is if the value 1 is selected specific text will appear if the vale 2 is entered specific text will appear and so on. so far i go to the drop down box select format cells custom
    and use this formula [=1]"octagonal";[=2]"round";"not selected";
    this works so far but i can not add options for if 3,4,or 5 are entered
    please please held of offer another solution.

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