Comments on: Excel logical operators: equal to, not equal to, greater than, less than

Many tasks you perform in Excel involve comparing data in different cells. For this, Microsoft Excel provides six logical operators, which are also called comparison operators. This tutorial aims to help you understand the insight of Excel logical operators and write the most efficient formulas for your data analysis. Continue reading

Comments page 28. Total comments: 1256

  1. I need help on a formula

    If J3 is less than 65 then A
    If J3 is equal to 65 then B
    If J3 is greater than 65 then C

    Thanks

    1. Hi!

      You can use the following nested IF's:

      =IF(J3<65, "A", IF(J3=65, "B", "C"))

  2. i need help on this its about paye(pay as you earn)
    want to work this out
    if B11 is greater than 25000 it must subtract 25000 from it and the remainder multiply by 30% and add 750, if less than 25000 but greater than 20000 it must subtruct 20000 and multiply the remainder with 15% and if its 20000 below it must do nothing

  3. 0.75 <= x < 1.25
    please some body explain it to me

    1. Hello Mehmood,

      In Excel formulas, you express this condition using the following AND statement: AND(A1>=0.75, A1<1.25)

  4. hallo

    i have token system
    how to use which formula for token calculate.

    value is
    150-600 is 1
    601-1000 is 2
    1001-2000 is 3
    2001-3000 is 4
    3001-4000 is 5
    40001-Above 6

    Please reply fast.

  5. Need to clarify the above question again

    i have to calculate c21*d21 to f21, if f21 value is equals to or less than "20" then f21 should show as "20" (20 is the minimum value) if the result is greater than "20" then the actual value should show in F21

    1. Hello Joy,

      Here you go:
      =IF(C21*D21<=20, 20, C21*D21)

  6. Hi Svetlana Cheushev,

    I have to calculate c21*d21 to f21, if f21 value is = 20 then f21 should show the actual value in F21

    can you help please.

  7. my previous post doesn't show everything I typed:

    I would like to have a well report a p value asterisk according to the following criteria:
    >0.05 "ns"
    less than or equal to 0.05 but greater than 0.01 "*"
    less than or equal to 0.01 but greater than 0.001 "**"
    anything <=0.0001 "***"
    Can anyone help?

  8. I would like to have a well report a p value asterisk according to the following criteria:
    >0.05 "ns"
    0.01 "*"
    0.001 "**"
    anything <=0.0001 "***"

    Can anyone help me write this function? Thanks!

  9. Hi i would like help with my formula
    If value1 is lower than 30 and value2 is lower than 30 equals 24,
    if not value1 is greater than 30 and value2 is greater than 30 equals 22,
    if not value1 is greater than 60 and value2 is greater than 60 equals 20.

    What i want is to check the size of something and give a range according to 2 measures, i mean if size is 24x28 the value is 24; if size is 24 x 40 the value is 22; if value is 60x24 the value is 20. It all depends on both sizes.

  10. Want to put age groups against age collected in a column. Was using if(A1>=20&A1<=25,"20-25","OKAY","NOT IN AGE LIMIT"). but not getting answer. Wanted to use nested if for more options.

  11. what is the wrong in the below formal

    =IF(G65,G610,2)

  12. I need to combine these 3 formulas into one
    1. A = less than or Equal to 5
    1. IF(AND(A15, A110,2, "0")

    thanks for your help

    1. Hi Hebah,

      I think you are looking for a nested IF formula like this:
      =IF(A1<=5, 1, IF(A1<10, 1.5, 2))

      The formula does the following:

      If A1<=5, return 1
      If A1>5 and <10, return 1.5
      If A1>=10, return 2

  13. I have three categories
    First on = 1
    Second one = 1.5
    Thread one = 2
    How I can do if function to get the below result
    = if (cell Nuber on 5 and <10 ,1.5,If cell Nuber on <10,2)

  14. I have three categories
    First on = 1
    Second one = 1.5
    Thread one = 2
    How I can do IF function to get the below result
    = if (C15 and <10 ),(1.5),If (C1 <10),(2)

  15. Apols Svetlana, seem to have deleted some of the text by accident before sending last comment. It should read:
    The formula i am trying returns the Medium scores as FALSE, which is: =IF(BU10>15,"High",IF(BU10>7<16,"Medium",IF(BU1015,"High",IF(BU107,"Medium",IF(BU10<8,"Low"))) it won't recognise the any of the Low scores.

    Kind regards,

    Terry

  16. Hi Svetlana,

    On a spreadsheet I am trying to give a word label to ranges of values in the previous cell. The formula i am trying is:=IF(BU10>15,"High",IF(BU10>7<16,"Medium",IF(BU1015,"High",IF(BU107,"Medium",IF(BU10<8,"Low"))) it won't recognise the any of the Low scores.

    Can you advise?

    Kind regards,

    Terry

  17. How do I solve with a formula when I input cell A1 any value ranged from 1000 to 7150 then cell A2 is equal to formula (A1/1000)*3.5, otherwise A2 should displays as 0?
    Thank you!

  18. How can you use the "unique" conditional formatting function ONLY when the cell is greater than zero or ""? Thanks

  19. Hi. My problem is this
    I need the sum of cell:
    A1: where when I type 1 it would have a value of 20, 2 would have a value of 25, and 3 would have a value of 60

    B1: where whatever value i would put would be multiplied by 60

    thanks very much

  20. hi,
    i just wanted to know that how can i compare from 3 row with each other with the percentage eg:A col contain 2.2,B col contain 2.25 and c col contain 2.23
    now which is greater by 5% can anybody help on this

  21. I am attempting to find imbalances amongst sum formulas. Some of the cells contain errors (#N/A) that I want to ignore. How do I do that?

    =IF((AND(J20,M20,P20)),"","X") is my current formaula but returns #N/A because of the errors. What should I change?

    Thanks

  22. Below formula will show me the latest date if A1 and B1 matches, if no match it show FALSE. I want the cell to be empty.

    =IF(A1=B1;MAX(F8:F100))

    1. Sorry wrong cell count F8-F100,

      Anyway I got the correct formula!

      =IF(A1=B1;MAX(B2:B100);"")

      This will make sure C1 is empty when A1 and B1 is matching

  23. Hi,

    I have 3 cells, A1 Total ordered (numbers) and B1 received orders (numbers), C1 should tell me the date when A1 and B1 matches.
    Is that possible?

    Or even better if possible:
    Total ordered A1 is counting dates typed in the column A2-A100. Same with received orders B1, counting dates from B2-B100.
    C1 could find the latest date from B2-B100 and then in formula make sure A1 and B1 matches to show the latest date from B2-B100, if no match then empty.
    That would make sure that today date is not late due to typing of the dates in the A and B column.

  24. how can i program a value that when i encode A instead of 1... so that when it will be summed up, it will still count as 1 and not 0?

  25. Hello,

    I need some help for an IF function to display the logical test for a number which is "greater than or equal to 1 and less than or equal to 30".
    Could you please suggest what I can put for this in the logical test?

    Twinkle

  26. Hi Svetlana, thank you for your help. I have two more questions:

    1)I need to have the following If statement return a blank value (a cell that is truly blank and doesn’t say “blank”) if it is false

    =IF(C10>I10, "YES")

    2)Using conditional formatting, is there a way to have two rules in one cell. For example, say I have a formula in C1 that can return a value of either “YES” or “NO”. If in cell D1 I want the cell to be highlighted green if the value in C1 is “NO” and red if the value was “YES”. How can I accomplish this?

    Thanks

  27. Need your help... not sure what formula i need to have to get the time interval between 2 time duration in minutes. also i need to have a message box error informing me that time interval should be atleast 5 minutes...

    =IFERROR(F22-E22)*1440

    1. Hi Jay,

      You can use a formula similar to this:
      =IF((F22-E22)*1440>5, (F22-E22)*1440, "less than 5 min")

      This won't display a message box, but insert the text "less than 5 min" in the cell if the time difference is less than 5 minutes.

  28. If I am trying to compare the following data...how would I write out the IF statement?

    If B7 is the same as B22 than it needs to equal d22?

    1. Hi Ashley,

      Here you go:
      =IF(B7=B22, D22, "")

  29. Hi, I need a formula for this:

    =IF(A1="YES”, B1+C1*0.93)

    So what I am looking for is if column A says "YES" then the value from the formula B1 + C1 * .93 will show in the cell I put this formula in.

    1. =IF(A1="YES", B1+C1*0.93, ())

    2. Hi Adam,

      Your formula is correct. If it does not work as you expected, then please give an example - what values you have in B1 and C1 and what is the expected result.

  30. I need to creaate a formula that calculates an amount based on the following:
    If amount =1,000,000 multiply by 70%, but if it is between 1,000,001 and 1,499,000 multiply by 80%, but if it is greater than 1,500,000 multiply by 90%, if it less than 1,000,000 make it = 0. Can you help?

  31. =IF(AND(A1>=80,A1=91,A1=101,A1=111,A1<=121),"SOUTH",))))

    already got it

  32. hi svetlana,

    i have a table of customer sales and want to grade them according to month spend, A, B, C and D. what formula would i need to define as per below;
    A = greater than 80,000
    B = greater than 41,000 and less than 80,000
    C = greater than 25,000 and less than 41,000
    D = less than 25,000 and greater than 0

    thanks in advance and look forward to you reply.

    daniel.

  33. hello i need help,
    for example,
    If A1 is equal to 80 up to 90 = EAST
    if 91-100 = NORTH
    if 101 -110 = SOUTH
    if 111-121 = WEST

    how can i make this in a if statement

  34. =COUNTIF('15 PP YR '!D5:NG5,"f")+IF(B3="FT">480,B3="PT">300)

    Here is what I have attempted. '15 PP YR'is a sheet, D5:NG5-adds up a row, if F. and then not sure which formula to use for if FT = full time the max is 480 turn red if above 480, then for PT = part time the max is 300 then turn red. Thanks for any help you can provide.

    1. I haven't gotten any assistance on my question, is there anything else you need. Thanks for any help, you can provide.

  35. hi please help me to create a formula-

    i want that the value should be count when the cell values is divide by 5 or grater than or equal by 5.

    For ex:- in 2 cell value is 2 0r 3 then sum should be 0 as per my condition (not divide not grater or equal to 5)

    if value 5 or 6 then sum should be 10. (both of divide by 5 and 2nd remains 1 but should not count in sum.)

    Ex2:- in three cell value is 5, 4, 7 then sum should be 10 (not count 4, value less from 5 & not divide 5)
    or
    if value is 15, 22, 34 then sum should be 65. (remains 0, 2, 4 which not counted.)

    or tell me formula for value of %.

  36. I need a assistance with a formula. In column a1 will be either FT OR PT, column b1 totals from sheet1 and needs to include if less than 300 if "PT" then RED OR if greater than 480 if "FT" then RED. How would I write that formula? Thanks for any help.

  37. Hi,
    I need help whit this:

    IF A2=1, how to autocomplete B2=0 and C2=0

    I need to type 1 in first column and the next two columns autocomplet whit 0(zero)

    Thank you!

    1. *in B2 =IF(A2=1,0,())
      *in B3 =IF(A2=1,0,())

  38. Start Week Close Week Week No
    24-Oct-15 30-Oct-15 84
    31-Oct-15 6-Nov-15 85
    7-Nov-15 13-Nov-15 86
    14-Nov-15 20-Nov-15 87
    21-Nov-15 27-Nov-15 88
    28-Nov-15 4-Dec-15 89
    5-Dec-15 11-Dec-15 90
    12-Dec-15 18-Dec-15 91
    19-Dec-15 25-Dec-15 92
    26-Dec-15 1-Jan-16 93
    2-Jan-16 8-Jan-16 94
    9-Jan-16 15-Jan-16 95
    16-Jan-16 22-Jan-16 96
    23-Jan-16 29-Jan-16 97
    30-Jan-16 5-Feb-16 98

    Could you please help me to provide IF(AND) formula for assigning week no
    For eg 20-Dec-2105 which is week 92

  39. 26-08-2015 7,900.00
    26-08-2015 17,917.00
    15-10-2015 10,307.00
    14-10-2015 29,590.00
    15-10-2015 3,864.00
    15-10-2015 24,210.00
    15-10-2015 14,061.00
    15-10-2015 14,631.00
    15-10-2015 48,663.00
    15-10-2015 3,846.00
    15-10-2015 37,751.00
    14-10-2015 4,800.00
    14-10-2015 6,393.00
    14-10-2015 33,025.00
    14-10-2015 91,100.00
    14-10-2015 4,693.00
    14-10-2015 10,657.00
    14-10-2015 33,663.00

    Above Sum is equal to this value 146071/- How ?

  40. Hi Svetlana
    I've have another one for you....
    I'm trying to us an IF formula for the following
    I have a calculation to determine if material was delivered on the date it needs to be delivered
    Formula: =U2-Q2 (Actual Deliver date-Need By date)
    If =0 "On Time" If =V2=0, -1, 1 "On Time" IF > -1 or <-1 "Late"

    How do I create a formula for this?

    1. IN addition, can I create rules based on customer without having to filter or add customer shipments to another tab. Or, is this a formula specific customers to independent tab.

  41. Hi Svetlana,
    I need a formula for this:
    If cell G begins with the words "Not Ordered" and Cell J doesn't equal "JL" "RE" "XE" then output in cell W should say "Ok to proceed"

    1. Hi Amoony,

      Here you go:

      =IF(AND(ISNUMBER(SEARCH("Not Ordered",G2)), AND(J2<>"JL", J2<>"RE", J2<>"XE")), "Ok to proceed", "")

  42. Hi Svetlana I'm wanting to display the days date in a cell the day another cell goes above 0.

    If Cell F1 changes value to above 0 on the 15/10/2015 I want cell M1 to display that date.

    Hope the above makes sense?

    Thanks

    1. Hi Mark,

      I am afraid no Excel formula is capable of doing this (

  43. I would like to use an excel function to get my answer,

    if my value if greater than equals to 300, i need an answer "Yes" - how can i get this formula..

    Thank you.

    1. Hi KJ,

      Here you go:
      =IF(A1>=300, "yes", "")

  44. hi I need help with setting up price brackets
    eg
    Bronze price bracket is 50 to 150
    silver price bracket is 151 to 200
    gold price bracket is 201 to 301
    platinum price bracket 301 +
    I need a formula for the above
    it need to have the to whole of the above for each cell because the price is different for each item

    1. Hello Nino,

      You can use a nested If formula similar to this:

      =IF(A1>300, "platinum", IF(A1>200, "gold", IF(A1>150, "silver", IF(A1>=50, "bronze", "")))

  45. Hello,
    I hope you can help me!
    I need to find a formula for to represent this in excel for students test scores:

    Beginning 0-10 which will be 1
    Developing 11-19 which will be 2
    Expanding 20-28 which will be 3
    Extension 29+ which will be 4

    IF A1==20,"3" BUT IF A1>29,"4".

    I really appreciate your help!!!

    thank you so much

  46. I need to combine these 3 formulas into one
    =IF(B7=101,(B8/(1-26%)))
    =IF(AND(B9>=26,B9<=100),(B9/(1-30%)))

    Your help is appreciated

    1. Hi Amanda,

      You probably want something like this:

      =IF(B7=101, B8/(1-26%), IF(AND(B7>=26,B7<=100), B8/(1-30%), ""))

  47. I have created the following IF formula but rather than giving me a value it is just returning TRUE, how do I get the value
    =IF(B9>=26,B9<=100,(B9/(1-30%)))
    100 TRUE

  48. What would be formula for the following

    If A2 is greater than 2 and Less than 6, SUM(B2*6) ?

    Thanks in advance

    1. Hi Sam,

      Here you go:

      =IF(AND(A2>2, A2<6), B2*6, "")

      1. Thank you so much.

  49. Hi how to write a expression suppose if B43 is greater than 150 and less than 500 then output should be 0.2 or if its greater than 500 and lesser than 900 than 0.3 please help.

    1. Hi Anish,

      Here you go:

      =IF(AND(B43>150, B43<500), 0.2, IF(AND(B43>=500, B43<900), 0.3, ""))

  50. Added to favorites!

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