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 100. Total comments: 4830
Ps: Can i do this with Countif function?
Hi again,i need some help.
In GDP column i have numbers equaled to the current year GDP.I want to count the values in the whole GDP column. In one cell to have information how many values i have in column GDP.Thanks!
Sashko
Hi Just to add to the above point i need to show the total number of due items in the next row
Total Amount Due :
Total Number of Due Invoices
Hi,
I am trying for a formula where if Column H is having due it should sum the total amount of Due from Column F
For example =IF((H9:H70)="Due","SUM(F9,F70)",0)
Column H contains Paid and Due
Please advised.
Hi, I need to write a formula to achieve following.
If (cell No.) is >1 and 1100 then "350" and If (cell No.) is >1101 and <2100 then "300" and so on
Can anyone help?
Thanks in Advance
hi,
=IF(AND(A1>1,A1=1101,A1<=2100),"300",""))
Hi,
=IF(AND(J12>1,J12=1101,J12<=2100),"300",""))
Hi, I need to write a formula to achieve following.
If (cell No.) is >1 and 1101 and 2101 and <3100 then "250" and so on......
Can anyone help?
Thanks in Advance
Hello. What a wonderful resource! I've learned a lot but unfortunately, not a solution to my problem. In column B I have a dollar amount. Column C is a dollar amount too, but by way of the vlookup function, so if there is no value returned, it has #N/A. I am trying to add columns B and C, but if column C is #N/A then you get #N/A when trying to add the two columns. I thought that if I used the IF function and said if C is > 0, then add the two columns, but if that argument is not true (it's #N/A), then just list what's in B. In other words, if columns B and C both have a dollar amount, then add them in column C. If column C does not have a dollar amount, then just list what's in B. Perhaps I should be approaching this differently?
Thank you very much for any assistance you can provide.
Hello Steve,
Thank you very much for your feedback!
You can use the following formula for your task:
=IF(ISNUMBER(C2),B2+C2,B2)
This formula works if the 2 cases are true:
=IF(AND(J4<50%, N4<75%), "Mit Attendance < 50%; Toes Cut < 75%")
I want to also add that if J4 is true, to output "Mit Attendance < 50%" and if N4 is true to output "Toes Cut < 75%".
How do I combine them to get 3 possible outputs? Thanks for your help.
Hi,
how bout if I return the value of the difference of two cells for the false item? goes something like this =if(A2=B2, "ok", =A2-B2). I tried that one but it says the formula contains an error, then it recommended this one, =if(A2=B2, "ok", =difference(A2-B2)), but again, no luck was achieved. A little help please. Thanks.
Hello, Marjorie,
Please modify your formula so that it looks the following way:
=if(A2=B2, "ok", A2-B2)
It still was not working correctly but I figured the problem was bcos I did not put % sign in the formula. My cells are all in percentages.
This is the one that worked:
=IF(AND(I11>=50%, L11>=75%), "Qualified", "Disqualified")
Thank you very much!
Hi,
I need 1 to be low, 2 to be medium and 3 to be high.
I tried out =IF(A5=''LOW'',''1'',,) but error. Where is the error and how can I correct them?
Hi Farah,
Try this formula:
=IF(A5="low", 1, IF(A5="medium", 2, IF(A5="high", 3, "")))
formula below:
=IF(AND(I11>=50, L11>=75), "Qualified", "Disqualified")
Hello Gbesimi,
Your formula is correct. Please carefully check your entry and numbers. I say this because if I11=49 and L11=75, it will show "Disqualified" as instructed; and vice versa. If there is still an error, please provide an example and I will help to the best of my ability.
Mr. Ninja
Pls see formula below. Atho both conditions are met, it is giving me Disqualified. Thank you.
Hello Sashko,
I believe I understand your question now. Every cell that contains the number '24', you would like to add 48 but if not, then sum all the numbers together. So if A1=24, B1=24, and C1=3; then your total you want would be 96, correct? On the other side, if A1=1, B1=2, and C1=3; then your total would be 6. This is what I am understanding from your clarification. If this is correct, I would use the formula below to calculate and verify if any cells contain the specific number '24'.
=IF(COUNTIF(A1:C1,24)>0,COUNTIF(A1:C1,24)*48,SUM(A1:C1))
Please verify if this is what you are wanting.
Mr. Ninja
Hi,Ninja.
Yes that is it ! It worked! Thanks for the help!
Hi,
I just cant figure it out how to do this so in cells A2 to C2 i have numbers.I want in cell D2 to get the sum of the numbers with the following conditions if any number is equaled to 24 in cells A2 to C2 that cell in the sum(D2 ) to be 48! Any cell! i just cant fugure it out! Can you help me?
Sashko
Hello Sashko,
To clarify, are the cells that contain value A2, B2, and C2? If so I would use this:
=IF(OR(A2=24,B2=24,C2=24),48,SUM(B7+C7+D7))
If not, please help clear up the confusion for a better answer.
Ninja
Hi,Ninja well it is hard for to explain but i will say it that way
If i have one cell for example C2 yes the result is 48 but i want if D2 is also 24 the sum to be 2.48=96 for every 24 to have 48 plus.I hope you understood the problem.Thanks!
Sashko
Hello Sashko,
I believe I understand your question now. Every cell that contains the number '24', you would like to add 48 but if not, then sum all the numbers together. So if A1=24, B1=24, and C1=3; then your total you want would be 96, correct? On the other side, if A1=1, B1=2, and C1=3; then your total would be 6. This is what I am understanding from your clarification. If this is correct, I would use the formula below to calculate and verify if any cells contain the specific number '24'.
=IF(COUNTIF(A1:C1,24)>0,COUNTIF(A1:C1,24)*48,SUM(A1:C1))
Please verify if this is what you are wanting.
Mr. Ninja
Which nottation is used 1 to 100
thanks and regards
Ratheesh
Hi,
I'm a day trader. I fetch data from Internet and the Market price updates in a particular cell in My Excel Professional Plus 2010. Is there any method where I can fetch that changing number and make it to a list of numbers updated by ticks so that during aftermarket time I could use those numbers for analyzing the data.
Thank you in Advance.
Riaz
How do you fetch the data from the internet pls?
Hi Svetlana,
I was wondering if you could help me out? I'm trying to update a formula in a cell which takes information from a set of cells which, in turn are subject to information from another set of cells.
E.g.
A1 Apples C1 Bananas
A2 Oranges C2 Plums
A3 Pears C3 Peaches
One of A1, A2, A3 will populate A4 depending on information in cells B1-B3 (say highest number), likewise C4 from C1-C3 depending on information from cells D1-D3.
I'm trying to write a formula in A6 based on the data from A4 and C4 again depending on which has the highest number in cells B4 and D4. The formula is something along the lines of =IF(AND(B4>D4),"data from A4", "data from C4").
As the information in cells A4, and C4 are subject to data from cells A1, A2, A3, B1, B2 & B3 and C1, C2, C3, D1, D2, & D3 respectively while A6 is subject to data from A4, B4, C4 & D4, how do I create the formula in A6 which takes in the data which is subject to change as opposed to any text e.g. "data from A4"?
If you can follow all of that I would appreciate any help you can give.
Thank you in advance,
Darren
Hi Darren,
If your task is to return the number from A4 if the number in B4 is larger than the number in D4, and otherwise return the number from C4, then you can use the following formula in A6:
=IF(B4>D4,A4,C4)
how can solve this problem
if 200 captured 4, 600 captured 8,& 1000 captured 10
pl. give the correct link
Hi,
use this below formula, I have taken 200, 600, 1000 in Column "A"
=IF(A1=200,"4",IF(A1=600,"8",IF(A1=1000,"10","")))
Hi Hemanth,
thanks for info.
but we need if any value is less than 200 it's captured "4"
if its 400 to 599 its captured "6" & it's 600 or above then itwill be captured "10"
Pl help
Hi,
=IF(AND(J10>0,J10=400,J10=600,"10","")))
=IF(AND(A7>=5.5,A7=5.5 and <=13
true = A7-0.5
false= if A7<5.5 true A7 False A7-1.
Please help me!
Hi Grissy,
Here you go:
=IF(AND(A7>=5.5, A7<=13), A7-0.5, IF(A7<5.5, A7, A7-1))
If A7>=5.5 and A7<=13 then A7-0.5,
if no then if A7<5.5,A7,A7-0.5
Can you help me
Pretty please!!! =)
Hi Svetlana,
there is a 9 figure number and a character(ex. 7730082766V) in a1. what I want is if the 3rd number of that number less than or equal 3, print "male" or if it is bigger than or equal 5, print "female" in b2. i tried with =if(mid(a1,3,1)<=3,"male","female") formula in b2. but it doesn't work. help me.
Hi Chaminda,
The point is the MID function always returns a text string, even if the original value is a number. You can simply multiply the result by 1 to convert it back to number, like this:
=IF(MID(A1,3,1)*1<=3,"male","female")
Alternatively, you can use the NUMBERVALUE function:
=IF(NUMBERVALUE(MID(A1,3,1))<=3,"male","female")
hi
iwant formulas Please explain i need help
I am trying to write a formula using data from a different tab that says "if cell in column A is not blank, count the number of cells in column V which are not blank". And make this applicable for an unlimited number of rows.
I have tried amongst others;
=COUNTIF('Action Register'!A2:A100,"",'Action Register'!V2:V100"")
=COUNT(IF('Action Register'!A2:A100,""), AND, IF('Action
Register'!V2:V100""))
I am getting a standard error message to say there is a problem with the formula every time. Any suggestions?
Kindly help me,
i want to apply formula ( IF function formula for text values ) to multi ple columns but i am not able to do
I would like to create multiple condition in single column
If 88000-44000 is more than 50% then multiply with 0.06% or equal to 50% then multiply with 0.14% of less than 50% then multiply with 0.21%
please arrange the same formula.
I have created 3 lists for date drop down menus. The lists are Month (Jan-Dec), Day (1-31), and Year (2016-2020). The problem I am trying to find a formula for is this: If February is selected as the Month, how do I prevent the days of 29 (for non-Leap Years) and 30-31 for all years to be selected from the Day drop down list? Not sure if Conditional Formatting or Data Validation is the way to go. If there is not a way to specifically prevent them from selecting 29-31 from the Day drop down list, then how to generate an error message when 29-31 is selected? Your help is greatly appreciated.
HI,
I need a small clarification in excel formula.
=COUNTIF(J6:J27,"Not Met")
I NEED A FORMULA FOR INDIVIDUAL DATES MET OR NOT MET. CAN ANY ONE HELP ON THIS
E F G H I J K
DATE START END TAT VOLUME SLA 13:00
2/13/2016 4:47 PM 12:00 26 Met
2/13/2016 15:00 35 Not Met
2/13/2016 12:12 45 Met
2/13/2016 13:14 82 Not Met
2/13/2016 15:00 1 Not Met
2/13/2016 12:12 45 Met
2/13/2016 13:14 82 Not Met
2/13/2016 15:00 1 Not Met
2/14/2016 12:12 45 Met
2/14/2016 13:14 45 Not Met
2/14/2016 12:00 45 Met
2/14/2016 15:00 45 Not Met
2/14/2016 12:12 82 Met
2/14/2016 13:14 26 Not Met
2/15/2016 12:00 35 Met
2/15/2016 15:00 45 Not Met
2/15/2016 12:12 82 Met
2/15/2016 13:14 1 Not Met
2/15/2016 12:00 45 Met
2/15/2016 15:00 82 Not Met
2/15/2016 12:12 1 Met
2/15/2016 13:14 45 Not Met
Hello there
Can anyone help me with this function, please: =IF(14<D9<17),"15"
I need that the cell takes the value of number "15" if the value from the equation in "D9" is between 14 and 17.
Thanks in advance
Hello!
Here you go:
=IF(AND(D9>14, D9<17), 15, "")
Dear all
Please tell me formula for
If sheet1 cell A1 dated match with sheet 2 date's column A:A
Ans will Sheet1 B1
Hi Ravi,
Use this formula in Sheet1 B1 cell.
=MATCH(A1,Sheet2!A1)
Hi Ravi
if its match will show "match" not match will show "blank cell"
=IF(MATCH(A1,Sheet2!A:A),"match","")
I need a formula for a table which I'm making which shows if someone has been active on Social Media for more than 30 minutes or not.(project with many members). I also want the cell to be colored Green, if active and red if inactive. Is this possible and how can I do that? Can someone give me the formula. Will be appreciated.
Thanks
Hello, Muhammad,
To help you better, we need a sample table with your data in Excel. You can email it to support@ablebits.com. Please add the link to this article and your comment number.
Hello,
I have two columns, one contains names, the other contains numbers. I have the names sorted in order I need so there are blank cells (i.e. A1=John, A2=Blank, A3=Joe, etc.) The other columns contains the numbers to match the names. But there are no blank cells (i.e. C1=2, C2=3, C3=4, etc.) How do I match the numbers to show next to the names and skip the blanks? So B1=2, B2=Blank, B3=3) I tried the IF function to pull data that contains text but what do I enter so that the numbers are shown next to the names? Thank you in advance for any help.
Hello, John,
To help you better, we need a sample table with your data in Excel. You can email it to support@ablebits.com. Please add the link to this article and your comment number.
I have a question, can you help me please?
If I have multiple sheets, for example sheet1, sheet2, sheet3 and sheet4. And each sheet has 4 columns. The first one has a reference number , the second has an information , the third has a time , the forth has a date.
I want to put if statement, for example if i put reference number 25 in sheet4, I want it to do a search itself in the whole sheets and to copy whole the data from whole sheets & whole columns to this specific sheet
How???
can u help me ??
Hello Joe,
Most likely you need to use the combination of INDEX and MATCH functions, please see this blog post that describes how to work with them:
https://www.ablebits.com/office-addins-blog/excel-index-match-function-vlookup/
Hi.
In pivot table report I want to publish report in below format.
Opening stock,REceived qty,Issued qty,Closing stock
to get this report in pivot table, what should be the format of reference data.
Thanking you..
Hello,
Please see our blog post on pivot tables:
https://www.ablebits.com/office-addins-blog/excel-pivot-table-tutorial/
It describes how to organize the source data and arrange the layout of your pivot table.
Good day,
I can't get the border format to follow the cell I'm copying in value_if_true in the IF command.
=IF(C13="Description",C18,"") where C18 is a value with the darken top border.
Maybe it can't be done with the IF command but if so, I will appreciate any help in this matter. I have over 640 lines to correct and doing it by hand is time consuming.
I could probably write a macro...
Sincerely,
Robert
Hello Robert,
The only thing formulas can do is change the value of the cell where they are entered. If you need to change the format of the cell at the same time, please create a conditional formatting rule that will change its border or color the way you set. If you want to change the border of the cell if it contains the word "Description", you will need to use the following formula in your conditional formatting rule:
=C13="Description"
Hello,
assume i have written in one column 100(Cell A1), 200(Cell A2), 300(Cell A3), 400(Cell A4), 500(Cell A5), 600(Cell A6). I want to multiply these by 1.25 and display the values in the same cell. eg. Cell A1 is currently display 100. Once it is multiply, the value is 125. Then that value should appear in the cell A1 instead of 100.
Can someone support me.
Dinesh
Hello Dinesh,
Please see http://stackoverflow.com/questions/809725/whats-the-quickest-way-to-multiply-multiple-cells-by-another-number
Can you give me a formula for this? To get the current name... Cell A has name then the condition, if the the cell B is empty value Cell A, if the Cell C is empty value cell B, if the cell D is empty value cell C, otherwise value current cell. Thanks.
Hello Joram,
It sounds like you need the following formula:
=IF($B2="",$A2, IF($C2="",$B2, IF($D2="",$C2,XXX)))
XXX is the address of your current cell. However, it is better to avoid using the address of the cell where you enter the formula as XXX, please see this blog post for more details:
https://www.ablebits.com/office-addins-blog/circular-reference-excel/
hi
need help in getting the value from another sheet if one condition is matched. the condition could be a unique number. can this be done by IF formula.
i did on a sample sheet and it was correct, however when i actually implemented on the actual sheet, the result shows 'FALSE'.
formula used i was as under
=IF(A2=DCR!B2,DCR!A2)
thanks
Hello, harji,
To help you better, we need a sample table with your data in Excel. You can email it to support@ablebits.com. Please add the link to this article and your comment number.
Hello, Is there a formula which would be able to tell me the following. I have already an if formula to find out if it equals 80% of a gross loan(which also has other factors such as fees, interest charged depending on how long the loan has been held for,) however if they don't equal 80% I have to have a calculation to find out what the value needs to be to equal 80% is this possible?
This is so I can have a calculator where someone can put the all the details in and it tells them what the figures need to be.
Many thanks in advance
Amy
dear madam,
i want to =if(c2"","completed","") please inform me to learning it.
WARM REGARDS,
NAVEEN.R
Hello Naveen,
Most likely you need the following formula:
=if(c2<>"","completed","")
You can learn how to work with the IF function from the blog post above.
Dear Mam,
I am Working as Business Analyst. how can i give a ranking to the companies based on their MAT score with IF function.
please clarify
I am working on a spreadsheet for a game challenge. I have a list of options: Baby, Child, Teen, Young Adult, Adult. The values are respectively: 0, 3, 16, 29, 49. I'm unsure how to write an IF function to add an option from the list's value + another cell that will be filled in. I think it should be =IF(A1="Baby", 0) But how would I put all the options in there? Basically, how would I make it so that whatever option is chosen, it would return the right value and then add it to the cell?
Hi Wolfy,
This can be done by using nested If functions, e.g.:
=IF(A1="Baby",0, IF(A1="Child",3, IF(A1="Teen",16, IF(A1="Young Adult",29, IF(A1="Adult",49,"")))))
Hello, I just ran into a problem with a formula i had help on before. I have 5 vehicles that i use in a spread sheet. i need a formula that will prevent from incorrect information because of odometer numbers running together. i use another spreadsheet with additional vehicles and the odometer readings are similar. =IF(C14>=174121, 15, IF(C14>=227425, 5, IF(C14>=208012, 21, IF(C14>=143916=72700, 9, 0)))))
#2 odometer is at 143916 #5 227425 #9 72749 #15 174121 #21 208012 Please help, thank you for your time, very much appreciated!
Hello, I believe I figured it out--- =IF(C33>=227425, 5, IF(C33>=208012, 21, IF(C33>=174121,15, IF(C33>=143916, 2, IF(C33>=72700, 9, 0))))) Formula in the correct sequence resolved problem, if incorrect, please let me know. Thank you
Reply
Yes, the updated formula is correct. Putting logical tests in the correct order is critical because as soon as the first condition is met, other logical tests are not checked.
Hi Svetlana. Thanks for the last reply, it was very helpful. However, I have a new problem I am struggling with.
I have a list of names in column A and B and I want see all identical names as "true" in column C. I have only managed to make an if-function which compare e.g. A2 with B2, but what I would like to do is to compare A2 with the whole range of names in column B. Something like =IF(A2=B2:$B$5626, TRUE). This does not work for me for some reason, do you know why?
Hi Andreas,
The IF function cannot compare ranges. I think you can use the following formula:
=IF(COUNTIF($B$2:$B$5626, $A2)>0, TRUE, "")
Please help, I need my formula to say if age is between 25-30 then its a certain cell, if its 31-40 than its another cell. how can I write it?
Hello Cristina,
You can write it in the following way:
=IF(B1<30,E1, IF(B1<40,E2,""))
Hello,
How can I assign a number to a text value and then add it?
Data Validation is present in A1, A2 & A3
Yes, No, Maybe are the values
I want to assign Yes=1, No=0; Maybe=.5 and then be able to add those values,
Example:
A1=Yes (1)
A2=No (0)
A3=Maybe (.5)
Total should be 1.5
Thank you in advance for your help!
Hello Michelle,
You need to add a column for the formula that will assign a number to the values in column A:
=IF(A1="Yes",1,IF(A1="No",0, IF(A1="Maybe",0.5,"")))
Copy it down the new column to get a number for each cell in column A. Then you can use the SUM function to add the values you get.
Светлана, would you be so kind to give me a hand on the following please? Assumption, in Sheet1 I have A1: toiletries ; A2: washing liquids A3: powders A4: toiletries; A5: conditioner etc. In Sheet2 I have B1: washing liquids; B2 powders, B3: shampoos; B4: toiletries; B5: shampoos etc. I Sheet2 I also have in C1: 213; C2: 325; C3: 564; C4: 912; C5: 487 etc.
My objective is: In cell F1 to have the following result -> If value in A1 (sheet1) matches value in B1 (sheet2), then return value from C1 (sheet2).
You help is very much appreciated. If you need more clarification on this matter please let me know. Зарание спасибо. Alex
Hi Alex,
If my understanding of the task is correct, you can use the following formula:
=IF(Sheet1!A1=Sheet2!B1, Sheet2!C1, "")
Светлана,thank you for your prompt response. Actually, I have realized the objective I have outlined is entirely incorrect. The actual output is: If VALUE in B1 matches the VALUE in the range A1:A5, then return the VALUE from C1. Correspondingly, when formula goes to B2 it has to check the range A1:A5 and if there is a match it returns the VALUE from C2.
Apologies for the confusion caused.
Светлана, no need to bother. I have managed to figure it out. Thank you anyway! Best Regards, Alex
Hi,
I have 3 column A, B,C and if A=B=C is Thrue, if not is False
Please can you help?
Thanks,
Loredana
Hi,
I need help trying to correct this formula.
=IF(OR(SUM(G8:R8)=0,(D7+F8),(SUM(G8:R8)0)),(D7-E8))
I am trying to have it read
if the sum of G8:R8 = 0 then add D7 + F8
if the sum of G8:R8 does not equal 0 then Subtract E8 from D7
However, it currently only Subtracts E8 from D7
Hello Karen,
You can use the following formula for your task:
=IF(SUM(G8:R8)=0,D7+F8,D7-E8)
Hi,
I am trying to use the IF formula, but need it to have more than two options, and I can't make it work. Please can you help?
e.g.
Grades are listed in Column B of the sheet. Then in column C I want to add the grade description.
If Column B = A, then I want column C to say Good.
If Column B = B, then I want column C to say Medium.
If Column B = C, then I want column C to say Bad.
When writing the formula please use cell B2 and C2 as the cells that the data is in. Thanks
Please can you advise the formula?
Hello Anna,
You can include several conditions in one formula the following way:
=IF(B2="A","Good", IF(B2="B","Medium", IF(B2="C","Bad","")))
You need to enter the formula in C2 and copy it down to apply it to the cells below as well.