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

  1. i want to use a formula for good or bad
    Examaple if i entre D6 value should have condition =< 12 is good and lower than 11.8 should be bad .

    Please help in how to use formula

    1. Hello Vishnu,

      Here you go:
      =IF(AND(D6<=12, D6>=11.8), "good", IF(D6<11.8, "bad", ""))

  2. Hi Svetlana, This is Amit.
    I want to check if numbers in first cell (3 numbers i.e.279) are matching with with second cell (8 numbers i.e. 27895613) and write result as "Match" or "Not Match" in third cell.
    for example,
    1. First cell - 123 Second cell 12435678 Match
    2. First Cell - 231 Second cell 23457698 Not Match

    1. Hi Amit,

      Try the following formula:

      =IF(A1=LEFT(B1,3)*1, "match", "not match")

      It compares a 3-digit number in cell A1 with the first 3 digits of a bigger number in cell B1.

  3. I need help creating a formula, please! I need column C to return today's date, only if column A and B both have a date in them. So if only one of the columns have a date in it then column C needs to remain blank. Column A already has an IF formula in it to populate it with today's date if another criteria is met. Hope there is someone who can help, as I am relatively new to formulas...Thanks!

    1. Hi Alice,

      If row 2 is the top-most row with data in your worksheet, you can enter the following formula in C2 and then copy it down to other cells in column C:

      =IF(AND(A2<>"", B2<>""), TODAY(), "")

      1. I was sure I had tried every variation possible, but clearly not! This has worked perfectly, thank you - I was about ready to scream :)

  4. Hi Svetlana,

    if have part of a If function =IF((AND(F33="Mild steel",F34="1mm")),"1.3".....

    is it possible to change to vale 1.3 to a cell that has the value in it, for example..

    =IF((AND(F33="Mild steel",F34="1mm")),"= F28"?

    if not. is there any way the "value" could be what is written in a cell?

    thank you in advance.

    Stephen

    1. Hi Stephen,

      If my understanding of the task is correct, here’s the formula you are looking for:

      =IF(AND(F33="Mild steel", F34="1mm"), F28, value_if_false)

  5. Ecxel is now a piece of cake.

  6. Give me a formula for:
    If c4=10 there will be 2500 commision, or if c4=15 there will be 5000 commiosion

    1. Hello ZAHIR,

      Here you go:

      =IF(C4=10, 25000, IF(C4=15, 5000, ""))

  7. i have two sheets 1 & 2. I need to put the employee names on sheet 1 columns a1:a10 to sheet 2 column d...what should be my formula? i want to automatically put there instead of retyping or copying it

    1. Hello!

      Just enter the following formula into cell D1 on Sheet2 and then copy it down to other cells:
      =Sheet1!A1

  8. I have 13 columns and 26 rows. Rows list names of staff and columns list the months of the year. For each staff name listed on each row, when "yes" is entered into any one of the 12 columns (months of the year), I would like the other 11 empty columns to automatically turn to "NO". That way it prevents "yes" from being used more than once in that year.

  9. I am trying to get an IF or or formula to work but having slight problems arise. My problem is that there are 36 state in india every state starting 2 tin no. are diffrece, i would like to ask that we want to formula as
    example: 27=Maharashtra,01=jammu & kashmir, 02=Himachal pradesh, 03= Punjab ----------------------------------------------------------- etc.
    i want to formula that ( if column no. is 27 that maharashtra than 01 jammu & kashmir as 36 state.
    So pls. help us.

  10. Hi kindly assist me with a syntax of If function that whent true types a value in a cell, ie, if a2=2, then it tyepes the value tyhat is in cell 3

  11. Hello Sir,
    One doubt,
    I have a set of production data for a month. I want to split it into two items based on two prices. ie: suppose I want to choose the data for the first 10 days, and the remaining days figures alone neglecting the first 10days figures,
    can u throw some light into this,
    thank u.

  12. somebody let me know what does it mean by formula =IF(A7="","",A7) in excell

    1. Hello Waqar,

      Your formula reads as follows:

      "If A7 is blank, return an empty sting (blank cell), otherwise return a value in A7."

  13. Hi there I want to make an If statement that will accept 2 values as being equal when being in a suitable range =IF(B14 = D14+-1,"Yes","No")

    Where B14 and D14 are numerical values that are equal to 1 decimal point

  14. is it possible to have a formula for multiple IF's or another formula for if A2 is upto 127.99 the output would be 15.33,if A2 is between 128 and 187.99 the output would be 35.15 and if A2 was 188 and 244.99 the output would be 48.26.

    Thanks

    Jason

    1. Hi Jason,

      You can use the following nested IFs:

      =IF(A2<=127.99, 15.33, IF(A2<=187.99, 35.15, 48.26))

      The above formula returns 48.26 for any number greater than 188. If you want to limit it to 244.99, add one more IF statement that would return an empty string for all numbers greater than 244.99:

      =IF(A2<=127.99, 15.33, IF(A2<=187.99, 35.15, IF(A2<=244.99, 48.26, "")))

  15. In Exel sheet, condition: suppose i put funtion in C4. value is A4 is 1000 than consider B4 value in C4 cell.

    Please suggest me formula.

  16. Hi,
    I have a report that generates to a word doc that I then import into a excel spread sheet. The text imported is Priority 1 Priority 2 Priority 3 or Priority 4, I cannot just import the number alone so I can then generate a chart from the imported numbers. What I was trying to use is an if to turn the Priority 1 to a 1.

  17. If the results of the following formula are <0 I would like to have the cell read "pending" instead of the actual negative number. Is there something I can add to the formula to make that happen?

    =IF(ISERROR(NETWORKDAYS(B54,L54)-1),"no data",NETWORKDAYS(B54,L54)-1)

    thank you

  18. What "if formula" can I use, to identify the following:
    If any of the column is empty (although others are completed), it should pop up a message?

  19. I need a formula that will alert me if there are 5 or more consecutive negatives (or losses) in a column? Help :)

  20. Hi there. I have 3 columns. I want a 1 in b1 to give 850 in total column e1, a 1 in c1 to give 1350 in total column e1, a 1 in d1 to give 750 in total column e1, if I use 2 in a cell I want it to multiply the number by 2 etc.

  21. If TV personality is popular OR if they earn less than 100k per year thay get 10% bonus else the column should diaplay nil..how can i develop that function

  22. I need a formula that will look at E6, E7, E8, E9, and E11. If 2 of them are >9 add .5, if 3 of them are >9 add 1. Any suggestions?

  23. like
    =IF(E13="Salary"),(L13*$M$10),"Nil")

  24. Hi Svetlana Cheusheva,

    Kindly if you could guide, If E13 is equal to "salary" (text), it should multiply the values mentioned in Cell L13 and $M$10, otherwise N/A. Thanks

    1. Hi Aamir,

      Here you go:

      =IF(E13="salary", L13*$M$10, "N/A")

  25. I want to learn excel.

  26. Hi Dear,
    I need a formula to G16 where if F16 says "YES" then G16=C16-8

    1. Hi Fatema,

      Here's the formula for G16:
      =IF(F16="yes", C16-8, "")

  27. A1 = RECEIVED / CANCELLED / DECLINED (Dropdown)

    If A1="CANCELLED" then A2, A3, A4... will show CANCELLED
    If A1="DECLINED" then A2, A3, A4... will show DECLINED

    but

    If A1="RECEIVED" then A2, A3, A4... must be blank

    Please advise. Thank you

    1. Hi Brenda,

      Here's the formula exactly per your conditions:

      =IF($A$1="CANCELLED", "CANCELLED", IF($A$1="DECLINED", "DECLINED", IF($A$1="RECEIVED", "", "")))

      And I believe this simpler one will work as well:
      =IF($A$1="RECEIVED", "", $A$1)

  28. how to Segregate the Employees Categories from Excel sheet through Formula ? for example I have too many employees job title so I want segregate their profession project location wise through formula how can we do please help.

    1. Hi, Svetlana,

      how to Segregate the Employees Categories from Excel sheet through Formula ? for example I have too many employees job title so I want segregate their profession project location wise through formula how can we do please need your help to give me the Idea Soon.

  29. Using an 'if' function to put in todays date (using 'today()'), but want the date to remain static and not move on when the spread sheet is opened the next day

  30. I am trying to accomplish a multi-faceted IF statement.
    IF cell>02131<40 Then 3

    Is this possible? thanks

  31. I am interested to make cascading drop down for 6 columns.
    1st col having 5 variables/options,2nd dependent col having in all 44 variables(6 to 14 for each previous options),3rd dep col having 65 variables,4th col having 480 variables.5th &6th having corrosponding 480 values.is it possible? much data for Name manager. Please help.is there any another way?

  32. hi,i m having problem while calculating IF function with time.All cell are formatted for h:mm.
    A1 for start of duty say5:00,B1 for getting machine ready(allowed 2:00)say 8:00(more by1:00).now C1 shows working hours for machine(max value 4:00 hour).formula may be =IF((B1-A1)>2,4-((B1-A1)-2),4),HOLD GOOD for for GENERAL formate.with TIME format h:mm shows error/invalid.please help.

    1. HI SWETA,I TRIED FOLLOWING
      IF((time(hour(I17-G17),MINUTE(I17-G17),SECOND(I17-G17)))<=2:00:00,4:00:00,4:00:00-(time(hour(I17-G17),MINUTE(I17-G17),SECOND(I17-G17))-2:00:00)),BUT DIDNOT WORKED.

  33. Hi Svetlana,

    I hope you can assist me. I need to compare various DATES in different CELLS and get back the Appropriate Date. Below is the formula I put in, but I keep getting #VALUE!........what am I doing wrong???

    =IF(Y9<TODAY(),AB9,Y9),IF(AB9<TODAY(),AD9,AB9)

    I need the formula to look at each date then compare it to TODAY and provide the correct date back

    Thank you in advance!!

  34. I am comparing two cells, both of which have dates,to calculate the number of hours and minutes minus non working hours and weekends. That was the easy part.
    If a cell has a date, I want to leave the date as is, no change. if the cell is empty, I want to use the now function so it evaluates to the current date and time so my first function properly returns. First function:
    =(NETWORKDAYS(F2,G2)-1)*($O$2-$N$2)+IF(NETWORKDAYS(G2,G2),MEDIAN(MOD(G2,1),$O$2,$N$2),$O$2)-MEDIAN(NETWORKDAYS(F2,F2)*MOD(F2,1),$O$2,$N$2)

  35. Hello again,
    I found a solution to my problem between your answers
    =IF(OR(AND(B1>=8;C1>=8;D1>=8);AND(B1<=0;C1<=0;D1<=0));"8,0";"")

    Thank's!

  36. Hello Svetlana!,
    I want a formula if possible like this =IF(F2=.....;F2*1,5;" ")
    but in column f there are only names and numbers(in €) for example 10,00€ and I want the word in order to choose only the ammounts

    thank you for your help!

  37. Hi Svetlana,
    Colud you help me abut this task. I want to create a single formula for the following "problem":
    A1 is 8 if the cell's between range B1:D1 is blank
    but alsoo i want for the
    same cell A1 to be blank (no data) if the cell's between range B1:D1
    contains number 8.

    Thank you.
    Best regards.
    P.S. this e-mail is correct

  38. Hi Svetlana,
    Colud you help me abut this task. I want to create a single formula for the following "problem":
    A1 is 8 if the cell's between range B1:D1 is blank
    but alsoo i want for the
    same cell A1 to be blank (no data) if the cell's between range B1:D1
    contains number 8.

    Thank you.
    Best regards.

  39. Hie Svetlana Cheusheva
    Please help me on the following.
    In a cell accepted Entry can be: Certificate, Diploma, Advanced Diploma, Degree or Master with the following amounts respectively, 5800, 8900, 12000, 15000 or 18000.
    Help me to write the If function so that such values can be used to be assigned to the respective variables.

    Thank you.

  40. Can you help please, I need a formula for:
    If G21 is <= to J3 then * by K3 but
    If G21 is <= to F3 then * by G3

    J3 and F3 are fixed amounts
    K3 and G3 are currency figures
    Thanks

  41. Dear,
    I have
    0-19 =Cat-3,
    20-49=Cat-2,
    above50 =cat 1,
    how to use if formula
    pls help
    vaule cat
    19
    24
    25
    35
    12
    45

  42. Hi i need some help with a formula if possible. I'm trying to do the following.
    In Cell C1 i have an amount "£"
    In cell E1 i want the word "paid"
    In Cell F1 i have the following "=SUMIF(E1,"paid",C1)"
    In Cell G1 i have this formula "=IF(E1="paid",NOW(),"Outstanding")"

    Now the problem i'm having is that if i copy this down my spreadsheet everytime i change a cell to "paid" every cell that already has a date in it changes to the date i make the new entry.

    Is there a way to keep the dates.
    For example.
    I input "paid" into a cell yesterday and the "date" shows as 4/11/15
    i put a "Paid" into a cell today and the "date" shows as 5/11/15 but keeps the previous day as is.

  43. Hi,

    I need some assistance with this...

    For Example

    =IF(G6>0,"FR")AND(H6+I6+J6=0,"NR")

    1. Hi Iris,

      I believe the correct syntax is as follows:
      =IF(G6>0,"FR", IF(H6+I6+J6=0,"NR", ""))

  44. It is to good.

  45. I am trying to get an IF or SUMIF formula to work but having slight problems arise. What I am after?! If cell A is 6, I need cell B to = Cell D x Cell E. Very simple I am sure however I cannot seem to figure it out. Any assistance would be appreciated. A real life example of what I am trying to achieve… If Sam buys 6 or less oranges it will cost her $1 per orange making it $6 however if Sam purchase 7 or more she will get oranges for 95cents each making the total $6.65 if she purchased 7.

  46. I found that if the text strings in the cells that I want to test are "TRUE" and "FALSE" then my if formula is not working as desired.
    Using your example in the above article how would you handle if your column C heading is 'Delivered (TRUE/FALSE)' and column D is 'Action Required (Yes/No)' ??

    I am able to control it if the string is anything other than 'true' and 'false' Are these exceptions or am I missing anything?

  47. Can you please assist me with a logical formula?
    Need to create a formula that will replace the word "YES" if Cell F2 is less than 25% of cell H2 or replace the word "NO" if this condition is NOT met.

  48. Hai i try to create a formula as follow
    I need the answer in C1.
    if B1A1------Late
    all other condition (if the cell is blank or the cell contains text) leave as Blank

    I try this one.... =IF(B1A1,"LATE",""))
    Can any one help me

  49. I am trying to create a formula that will replace the min value between d20:d27 if it is less than e2 with e2. my failed attempt is below:

    =IF(MIN(d20:d27)<E2,REPLACE(C20:C27,C20:C27,3,E2))

  50. I've built an evaluation form. It looks like this:
    Agent greeted the customer: Yes No N/A Score
    Agent sounded professional:
    Agent ended the call properly:

    Now; I want to have check/option button under each attribute. So, If I check Yes; it should place 4.5 under the score. If I check No; it should place 0 under the score column and so on...

    Thanks,

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