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
by Svetlana Cheusheva, updated on
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 123. Total comments: 4830
Dear Svetlana,
I would like requesting help from you, I need in excel Coulmn A2 to A100 each coulmn having different numbers and I need to display in B2 column "More Line" if A2 to A100 coulmn's any numbers greater than 3.
Lines
1
1
1
1
1
2
2
2
3
3
Hi Abdul,
Try the following formula:
=IF(MAX(A2:A100)>3, "more line", "")
Hi Svetlana
A2, A3, A4 and A5 cells have the following info
Lost
Abandoned
Won
Open
What conditional formatting I must use so that if an OPPORTUNITY_STATE is "Won" than it turns the background green, "Lost" or "Abandoned" it turns red and "Open" it turns blue
Hi Joe,
Select the cells A2 to A5 and create 3 rules with the following formulas:
Green: =$A2="won"
Red: =OR($A2="lost, $A2="abandoned")
Blue: =$A2="open"
how to filter different font colors in excel column in old version..
please help me
Hi Svetlana, I was hoping to get help on the following:
If the Average of cells B2 through B14 is greater > then the Average of B9 through B14 , fill in the number of the Average of B2:B14. If not (if the other Average is a higher number) fill in that number in the cell.
This is how I am doing it and it is not working
=IF(AVERAGE(B2:B14)>AVERAGE(B9:B14),"=AVERAGE(B2:B14)","=AVERAGE(B9:B14)")
Thank you
Hi Valeria,
You were almost there :)
=IF(AVERAGE(B2:B14)>AVERAGE(B9:B14), AVERAGE(B2:B14), AVERAGE(B9:B14))
Hi All,
Just wondering if you can help me with below validation?
B7 text:I have a drop-down here with Yes or No selection (achieved with data validation)
B8 text: Here is my challenge. If in B7 Yes is selected I would like to mark B8 cell with grey color. If No selected in B7 I would like B8 to remain blank.
I tried Conditional formatting (=IF($C$7,"No") then no format set but doesn't working.
All helps, ideas, suggestions are appreciated.
Elizabeth
Hi Elizabeth,
IF is not needed in Excel conditional formatting rules because they are conditional per se.
Try creating 2 rules for B8 with the following formulas:
Grey: =$B$7="yes"
No format: =$B$7="no"
Hai Svetlana,
Thanks for help but I need something different as follows :
A is the date column, B Column is text which can be repeated in same column with another date, C column is another text which can also be repeated corresponding to column B,
Now I need formula if date is less than today and if text in column B and C matches then get cell data of day before yesterday with same text combination.
Pl. help
Hello,
I am trying the If statement as follows =IF(C2="delivered", "No", "Yes") but everytime excel returns with: the formula contains an error.
How can I fix this?
Nevermind solved it
Thank you anyway.
Hi Sander,
The formula is correct and works fine in my Excel. Probably you have the List Separator set to ";" in your Windows Regional settings. If so, try replacing commas with semicolons:
=IF(C2="delivered"; "No"; "Yes")
Yeah, but that was not the problem. It has something to do with the quote signs,these signs do not work "delivered" but if I do the this =""""" the formula correct itself and works fine.
Not really sure whats going on but it works.
Thank you for your help Svetlana
Sander,
This is very strange indeed... Though, sometimes "smart quotes" copied from a web-site may cause a problem and retyping straight quotes in the formula bar fixes it.
Hi,
I have an attendance chart for my employees. If they have an infraction, it adds a value like +1 or +.5 based on whether they were late or called in sick. If they work an extra day or overtime, it removes a value like -1 or -.5. I use the COUNTIF formula, but the problem I'm having is if they have more OT than call outs, when they call in sick again, it doesn't adjust the 0 balance to +1 (because there are more negative values in the SUM). Can I use the IF function to keep a running total, so that if their value is already at zero it will still add +1 despite there being more negative numbers in the SUM?
Example: Callout twice in a week (+2), work 3 extra days (-3, but the max is zero as you can't go negative). Call out (+1), the value is still zero, but it should be 1.
Hello Svetlana,
I am writing this formula in Cell E3 :
=IF(C4:C9="x",0,15)
if column c4 to c9 has an "x" or "X" in it it should show zero other wise the value 15. it is showing me #NAME?
I also tried running :IF(C4&C5&C6&C7&C8&C9="x",0,15). this works for the first cell C4 and the value on E3 changes to zero but as soon as i enter x in c5 or further it shows 15. where am i wrong?
thank you
Hi Asif,
Just add the AND statement in the logical test, like this:
=IF(AND(C4="x", C5="x", C6="X", C7="x", C8="x", C9="x"),0,15)
Svetlana,
what i was trying to accomplish was that if any of the cells contain "x" it would show a zero. i used your formula and switched the AND with OR and mission accomplished. thank you so much
hey
please need your help...
i want to calculate net absentees of an employee. condition is:
1- two days per month are allowed (no deduction is applicable)
2- if absentees exceed 2, then deduction is made.
3- want to calculate net absentees. where days absent is less than days allowed, the formula shall give ZERO answer.
4- days allowed cell # C10, days absent F10
Please help.. thanks
Hi Svetlana
Please help me to write a formula for the following requirement;
1) If number of days between cell A & cell B ≤ 50% of number of days between cell A & cell C and Cell E ≥ 60% of cell D then format cell F with "SAFE ZONE" with Green filled.
2) Else cell F with "CRITICAL" with Red colour filled.
Respond me asap. Thank you in advance.
H Svetlana
Have the following:-
Cell A Cell B Cell C Cell D
1000 TX 60 -
1000 BL - 60
Need only to populated only 1 cell (either C or D)
with 6% multiplied by Cell A based on status of B (TX or BL). Can this be done using.
Thanks
IF
i want to check more than 2 value what will i do..
Example, if(A1>100,"3.95",A1>150,"3.25",A1>200,"3.00")
You need a nested IF formula in this case:
=IF(A1>200, 3, IF(A1>150, 3.25, IF(A1>100, 3.95, "")))
Please provide me that equation.................
Dear Mam,
if the value of A1 is greater than 200,A1*0.15 Please provide that equation.....
Hi Hari,
Here you go:
=IF(A1>200, A1*0.15, "")
thanks
Hi,
I need formula if date is less than today and text of two columns are matching then get cell data of the same text from corresponding another column.
Thank You
Hi Brajesh,
You can use a formula similar to this:
=IF(AND(A1<TODAY(), B1=C1), D1, "")
Where A is the date column, B and C are the columns to match, and D is the column to extract the data from.
Hai Svetlana,
Thanks for help but I need something different as follows :
A is the date column, B Column is text which can be repeated in same column with another date, C column is another text which can also be repeated with column B,
Now I need formula if date is less than today and if text in column B and C matches then get cell data of day before yesterday with same text combination.
Pl. help
Hi,
What I am trying to do is I need total of A1 and A2 in cell A3 but once it gets to a certain number I need to have some kind of text in cell A3 says your total is over budget
I have tried this formula but I did not work
=sum(a1+a2;if(a3>300;"your total is over budget))
Thank you
Hi Tolga,
Try this one:
=IF(A1+A2>300, "your total is over budget", A1+A2)
Thank you, you are the best
Hi I am trying to do a formula like J1 125 THEN 2 Else >200 OR <400 Thne 3 how to do please suggest
A1, so good mam
Hi I am trying to do a formula where in d3 it has a percentage and e3 has a number. That's the easy part what I'm stuck on, is I want f3 to be a number where if the d3 is under 5% it's 0, 5-10% is 1 and over 10% is 2 and if e3 is 18.5 or less it's 2 18.6-19.9 is 1 and 20 or over is 0. But I need these scores to only show and add up in f4. Is that even possible?
After rereading the page several times I have now been able to figure out the formula myself.
Hello There!
I would like compare 2 time frames and return a text. In other words, in Column A I have Week Ending 12/31/2015, Column B Week Ending 12/31/2015 and Column C the entered the word New Years next to the week ending date above. If Column A week ending date matches Column B then return Column C text, if not keep looking until the correct week ending date is matched. Let me know if you need further clarification and thank you for your support.
Need a formula for the below.
If the amount in a another cell is less than $1,500,000.00 the cell should read 60%. If the amount in a another cell equal or greater than $1,500,000.00 up to $2,999,999.00 the cell should read 70%. If the amount in an another cell is greater than and equal to $3,000,000.00 the cell should read 75%. Please help
Hi Diana,
Here you go:
=IF(A1<1500000, 60%, IF(A1<=2999999, 70%, 75%))
For the percentages to get displayed correctly, remember to apply the Percent format to the cell.
how can I use If function so that a value is set if true otherwise the user determine the vale
for example : If( B4="good" , 0, enter a value)
can I use it in fill color?
Nope. You can change the background or fill color of a cell by creating a conditional formatting rule.
How do I set up a formula to equal 1 if one cell is the same letter as another or 0 if there is no exact match. For example:
B1= C, C1=C therefore the value is 1
or IF B1=C and C1=D, the value is 0
Hi!
Here you go:
=IF(B1=C1, 1, 0)
I need a if statement on the below example:
if employe = Government, Banking , Insurance and >300 it should give 3 and more than >1000 it should give 5
Hi can you help me write a formula for multiple if's. I am trying to make the cell say if G18=2 then print 5.00%, if G18=3 then print 10.00%. If G18=4 then print 15.00%. Going up to if G18=10 then print 45.00%. However when I put in multiple if statements it says TRUE if there is a value in the range or FALSE if not. The formula I put in is, =IF(G18=2,"5")=IF(G18=3,"10")=IF(G18=4,"15")=IF(G18=5,"20")=IF(G18=6,"25")=IF(G18=7,"30")=IF(G18=8,"35")=IF(G18=9,"40")=IF(G18=10,"45").
Please ac==can you help as I cannot find how to do it.
done it don't worry, I did this instead =IF(G14=2,5,IF(G14=3,10,IF(G14=4,15,IF(G14=5,20,IF(G14=6,25,IF(G14=7,30,IF(G14=8,35,IF(G14=9,40,IF(G14=10,45,)))))))))
Hello,
I would like to know the formula for this problem.
409 is in A1 cell.
i tried with if formula - I am not getting the result.
out of 409 units - for the first 100 units sold at 2.60, 101-150 units
sold at 3.15, 151-200 units at 3.55 and 201-409 units sold at 3.85.
kindly guide me
I have an issue with excel 2010. I have a cell B24 with a formula that produces a number result. I also have cell D13 with a formula that produces a number result as well.
In a third cell I want the results of B24 and D13 to be compared. Currently, the formula in this third cell is =if(D13=B24,"OK","STOP!!") however it is not working... Please help. :)
Hello Wikelani,
The formula is absolutely correct and I don't see any reason for it not working. Does it deliver wrong results in your worksheet?
Hi.
I have spent several hours on this IF formula and it's still really not doing what i want.
=IF(F3I4;F3*1,45;IF(F3>J4;F3*1,4;IF(F3>K4*1,35;IF(F3>L4*1,3;)))))
H4=1000 I4=1500 J4=3000 K4=5000 L4=10000
What i am trying to obtain is that if value in F3 is between 0-1000 the amount in F3 is to be multiplied by 1,50. if the amount is between 1001-1500 it is to be multiplied by 1,45 and if F3 is between 1501-3000 it is to be multiplied by 1,40 and so on
Seems to be working for the first 2 but then it continues to multiplie all the other with 1,45
Any help would be very appreciated
Hi Vegil,
You can embed the COUNTIF function in the logical_test argument, like this:
=IF(COUNTIF($B$1:$B$6,$A1)>1, "More than 1 values match in Column B", "")
Hello,
I want to compare column A and B and if the value of column B has more than one match from column A the formula should return an error. For example, I have entered "America" in A1 and if there are more than 1 "America" in B column values it will return "More than 1 values match in Column B". Can you help me give the excel formula for that?
Hello,
Issue is I need to display certain modified dates dependent on what abbreviation is in block D2 I need to add +30, +60, or +145 to the date in Column M depending on what is in Column D and if D is blank then I need E to be blank also which is where the modified dates will be shown. what I tried is “=IF(D2=AAM,M2+30,””)&IF(D2=ARCOM,M2+60,””)&IF(D2=MSM,M2=145,””)”but that obviously is not working what is the secret formula to make magic happen.
Please use
=IF(D2="AAM", M2+30, IF(D2="ARCOM",M2+60,IF(D2="MSM",M2+145,"")))
Hallo! First of all, thank you very much for helping so many people!
I am experienced with Excel, but I am having problem with this: I have two cells (they can contain an error or not). In case of no errors, return the sum of them. If one of them has an error, return the one that hasn't.
I am doing this below for example, but it´s missing the last part (between " "):
=WENN(UND(ISTFEHL B1=FALSCH;ISTFEHL B2 =FALSCH);B1+B2;"the one that has no error")
Yeah, it´s in german. Wenn=if, und=and, istfehl=iferror, falsch=false. At the moment, the error that those two cels can have is "#BEZUG!", but I want the formula to work in case of any errors.
Thank you beforehand!!
Hi Mia,
I am not sure I fully understand the required logic, but you may try a formula similar to this:
=IFERROR(B1+B2; "the one that has no error")
So far, I'm using
=IF(L3="Regular seating","1","0")
=IF(L3="Procession/Nominee-Seating","1","0")
=IF(L3="Other","1","0")
but I don't know how to tally up the number of each of the replies, which is really what I need to do.
Can you help? THANKS
Hi Chip,
I think you can use the COUNTIF function, as demonstrated in the following tutorial:
https://www.ablebits.com/office-addins-blog/excel-countif-function-examples/
For example, =COUNTIF(L3:L100, "regular seating")
Hi I am currently running the formula =NETWORKDAYS(K21,M21,Holidays!A25:A31)-1
looking to add into that formula IF(K21="N/A","N/A") but I can't seem to get it to sit right with the formula, basically I am looking to make it run the formula if there is a date input into K21 but if N/A is put into K21 I want it to display N/A rather thank the #value error etc? hopefully this makes some sence?
Hi Leigh,
You can wrap your formula in the IF function in the following way:
=IF(K21="N/A", "N/A", NETWORKDAYS(K21,M21,Holidays!A25:A31)-1)
Thank you so much, I tried every variation but couldnt for the life of me get it to work! haha @:)
Sorry, my example removed all the blank cells
Hi Jim,
Try the following formula:
=IF(AND(A1="x",B1="x",C1="x"),"yes","no")
Hello, I am trying to create a result from three columns who's value is X (the actual text X)
IF all columns = X "Yes"
IF any or all columns are blank = "No"
A B C D
X X X Yes
X X No
X X No
X X No
X No
X No
X X No
X No
No
Hello,
I am trying to design a new spreadsheet as below
22/05/2015 05/06/2015
07/05/2015 07/05/2015 21/05/2015
Basically I want cell c to add 7 days to cell a if there is not date in cell b. If there is a day in cell b I want it to add 7 days to the date in cell b
Hi John,
The formula can be as simple as:
=IF(B1="", A1+7, B1+7)
Just remember to apply the Date format to column C.
Hi,
please help me to solve my problem. see formula below
IF(S64"closed",R$1-S64)
R1 value July 13 2015
S64 value July 13 2015
so the answer is zero but it shows false
i need zero answer
Hi Kyra,
You have the same cell reference S64 both in the logical test and value_if_true. It simply cannot be "closed" and "July 13 2015" at the same time :)
Hi,
I refer to the previous value of the cell using INDIRECT (ROW, COLUMN) formulae but only want to do this IF the date is the same IF date changes I want to keep fixed value of 500
it would look like this but I am not sure of what formulae to use
IF( DATE SAME use INDIRECT (ROW COLUMN) IF DATE DIFFERENT FROM PREVIOUS use value 500)
This is to track the amount of money entering in a day with an amount of 500 reset at the beginning of the day.
Thank you,
Aashman
Thanks a lot Svetlana. Using the IF function with ISNUMBER and Search helped me solve a situation in Excel.
Hi,
A cell has a date entered in it. Now I want to pop-up an alert, or ring an alarm if the date is today. How can I do it.
Hi,
I am needing a formulae to highlight the cells if the date entered is within a week from the current date. How can I do this?
Hi Iona,
Do you want to highlight dates that are +- 7 days from the current day, or those that are within the current week?
I would like it to highlight dates that +7 days or less from the current.
Iona,
You can create a conditional formatting rule with the following formula:
=ABS(TODAY()-$A2)<=7
Where A2 is the top-most cell with a date.
That's great thanks. How do I change the words 'TRUE' and 'FALSE'.
The formula returns TRUE and FALSE when you enter it in a cell. If you create a conditional formatting rule with this formula, it will highlight the cells that meet the condition. For the detailed steps to create a rule, please see the link in my previous reply.
If you want the formula to return some other words, enclose it in the IF function, for example:
=IF(ABS(TODAY()-A2)<=7, "recent date", "older date")
Works perfectly, thanks.
7/10/2015 6/10/2015 In this cell i want the Latest one.
6/10/2015 7/10/2015 In this cell i want the Latest one.
How could it Possible.
Hi Suvendu,
Supposing that the dates are in columns A and B, you can use the following MAX formula:
=MAX(A1:B1)
I am trying to use a IF/Find or IF/Search expression to locate the total expense associated with a particular budget name. I want to search an entire worksheet for a particular name "Total 81320 Communications" which may be in column c or d of the worksheet - and then report the value found in column x from that same row as the name.
Is this the correct way to build a formula - with the IF(ISNUMBER (SEARCH"text",worksheet A1:V100)
Hi NANCY,
Yes, it's the correct approach. Here's a real-life formula example:
=IF(ISNUMBER(SEARCH("deliv",C2)), "No", "Yes")
You can view the result the formula returns in "Example 3. IF formula for text values with partial match".
Hi Team,
I have a list of entries. In that only 5 entries are critical and score given is high. If any mistake in any one of the cell overall score should be zero. Can you please help me how it can implemented
Hi,,
in pivot table, figure show in thousand. I want this amount in Lacs, how to convert this.
Example : suppose result in pivot table is 500000, but it would be showing in as 5.
Pl. help
I am faced a big problem. need your urgent help.like below
BE=1st
OB=2nd
US=3rd
RS=1st
KR=2nd ...........................
but i want a formula when i put BE then automatically convert another column 1st or 2nd or 3rd,
Please help me................................
Hi Svetlana,
I just want an answer for my work. It happens that our shared worksheet contains some formula like this:
=IF(PO2>PT2,CONCATENATE(PT2,"-",PO2),CONCATENATE(PO2,"-",PT2))
cell PO2 contains: Brussels (Greater Area)
cell PT2 contains: Dublin (Greater Area)
result: Brussels (Greater Area)-Dublin (Greater Area)
I'm just wondering how does the formula performs and calculate the "string" ?? It did recognize which is greater in both cells. Coz I am only aware that the ">" function only works with numbers. So hopefully you could help me with this. Thank you so much in advance Svetlana and have a good day ahead.
I need a formula that will do the following:
Cell A:A = "City-name"
Cell G:G = total hours > 0.00
I need to place in Cell H the total hours of rows G:G if A:A = "City-name"
Keep in mind that I have two ranges here in the equation. A:A is row list of cities that I can choose from. G:G is a row list of hours that I need totaled for each city name in cell H:H
Hi, In Sheet1, I have 2 columns i.e. Company_Name and Credit_Period(No.of Days). In Sheet2 the company name appears in several rows and in the adjacent cell, I want it to pick-up the credit period (as mentioned in Sheet1). Can you guide for a formula please.
Thanks in advance for your help.
Upon further research on your website, I found the requried formula https://www.ablebits.com/office-addins-blog/excel-index-match-function-vlookup/
Superb. Thanks a lot.