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 105. Total comments: 4830
Pleas help me what formula should i have to use. If cell
A1=1 the answer should D1, then
A1=2 the answer should D2, then
A1=3 the answer should D3, then
A1=4 the answer should D4, and so on.
hoping for you quick answer.
Many thanks.
Hi Svetlana,,
Thanks for the solutions you've shared. I found them very helpful, though I am not that 100% sure that I can get them right. I haven't tried yet some of them, and to what my concern is, I didn't find a solution to my problem still despite of all the shared solutions. Could you please direct me to a certain solution to my case?
My question was, how may I convert a given sample/answer (ex: 3days 10hours 35minutes) in a certain cell into a total minutes only (ex: 382719)?
In other words I just want to simply convert them into total minutes using 1 formula with the given sample above as: 3days 10hours 35minutes
Many thanks,
Adzhar
Reply
if the cell has a vlue it has to take that value or else it has to take next cell value by multiplying *3.75
Ex-if A1 has a vlue it has to take A1 or else it has to B1*3.75
Anybody can help to solve this function
Hello Hashid,
Here you go:
=IF(A1<>"", A1, B1*3.75)
Thank you Svetlana ..Thanks alot it is very help to my day today work..once again thank you...
I have one table that has a Zip code and other info about a person and also needs a County column filled in this same table. I have another table that has Zip Code with a County connected to it. How would I approach this?
table 1 that needs the county info attached has the following columns.. Zip is H. Where I need the data is N. The other table where im pulling the county info from is.. Zip is column T and county column V
Hello,
I have an Excel spreadsheet where multiple people update frequently. I want column L to automatically update with the date when column J (status) was updated with any text information. Can I use If formula, and if so, how do I write it?
Hi there,
good day. I am trying to make a date to a number (the month to be number 1,2,or 3), but I don't know how to set the formular, could you please help?
example:
2/Jan/16 = 1
3/Mar/16 = 3
5/Apr/16 = 4
Thank you very much in advance for your kind help. Looking forward to hear from you. have a great day.
Hi Joyce,
You can use the MONTH function for this, and the formula is as simple as =MONTH(A1) where A1 is a cell with the date.
Hi Svetlana Cheusheva,
Thank very much, wish you have a pleasant day :)
Hi,
I have a customer list in excel, and am trying to mark each customer as either 'new' or 'repeat'. A new customer is one that appears only once in the list, and a repeat customer appears in the list more than once.
Can you help with this? Thank you so much.
Hi Mick,
You can use a formula similar to this, where column A is customer names:
=IF(A1="", "", IF(COUNTIF(A:A, A1)=1, "new", "repeat"))
Why is this not working?
=if(G1="",E1,G1)
However, when G1 is blank "", it is not giving me the value of E1, it is just showing a blank cell?
When G1 contains a value, it gives me the value of G1
Am I overthinking this?
Hi!
Your formula is all right, and you can make sure of this by testing it on a new sheet. Most likely there's some issue with your source data, but it's not possible to pin down the root of the problem without seeing it.
hi,
I have 4 excel sheets and work done in all sheets is of same kind, i work on particular numbers. so i want a formula by which i can know while working in any sheet that on this number you have already worked whether by coloring that number or highlighting or by any way. can anyone here hlp?
Hi Svetlana,
Good Day, I am working on two different cells, one cell has 4 categories(james,nadine,clark,leah) while the other cell has 3 options (yes, no, NA). Per category has different values, let say for james, the value of (yes, no, na = 20, 0, na), whilst, nadine has (10, 0, na). This is my formula but it doesn't seem to work:( I know there is too many conditions. I do not know how to simplify it. Thanks in advance and more power.
=IF(C104="james",IF(D102="yes",10,IF(D102="no",0,IF(D102="NA",D102)))):IF(C104="nadine",IF(D102="yes",20,IF(D102="no",0,IF(D102="NA",D102))))
Hello, Mitch,
Could you clarify what result you need to get? If no is selected for James, what needs to be displayed in the resulting cell? Thank you.
Mitch,
Please try this formula:
=IF(D102 = "NA", "na", IF(D102 = "no", 0, IF(C104 = "nadine", 10, IF(C104 = "james", 20, IF(C104 = "clark", 30, IF(C104 = "leah", 40))))))
Please modify the values for clark and leah according to your data.
% time exceed ranges from +51% and above 1
% time exceed ranges from 1% to +50% 2
% time exceed ranges from 0% to -24% 3
% time exceed ranges from -25% to -50% 4
% time exceed ranges from -51% and below 5
can you help me write a formula with these. if like for example cell a1 reach value of +51% and above it gets the value of 1, so on.
Hi, how can i formulate the value of YES to 4 and NO to 0? Meaning, all YES are equal to 4 and NO is 0.
Thanks
Hi Mervin,
If you want to input 4 or 0 in some column depending on the value in another column (column A in this example) in the same row, you can use the following formula:
=IF(A1="YES", 4, IF(A1="NO", 0, ""))
If you want something different, please clarify.
I am trying to formulate an spreadsheet to determine employee vestment. I need a formula that shows if the date in C2 is two or more years from the current date then D2 will show YES but if it's less than two years from the current date D2 will show NO.
Hello Tiffany,
Does "the date in C2 is two or more years from the current date" mean 2 or more years in the past or in the future?
If C2 is a past date, you can use the following formulas:
To calculate the difference in complete calendar years, use the DATEDIF function:
=IF(DATEDIF(C2, TODAY(),"y")>=2, "YES", "NO")
To calculate the difference by subtracting the year in C2 from the current year, use this formula:
=IF(YEAR(TODAY()) - YEAR(C2)>=2, "YES", "NO")
If C2 is a future day, you just need to swap today() and C2 in both formulas.
Sorry, i pressed enter before i could finish.
Table 2
Year Period Date
2012 1 01/01/2012
2012 3 03/01/2012
I would like to put a date in table 1 under the ? column if the two condition of the year and period are meet corresponding to table 2.
I hope that makes since. I have been trying to use a IF formula, but to no luck. Am I missing something.
Thank you.
Can i use a IF formula to perform the following.
Table 1
Year Period ?
2012 3
Table 2
Year Period Date
2012 1
I have a spread sheet for some frequency assessments for the testing of equipment. There are several boxes at the beginning of the assessment sheet where I add in a number and a box at the bottom which gives me a overall score, from all the upper boxes being added together.
I want to put another box next to overall score box, that will be auto-populated with text and that text will be dependant on what the score is.
E.g - If score is between 1 - 14, then the box should show the text "3 Yearly".
15 - 29 = "2 Yearly"
30 - 44 = "Yearly"
45 - 60 = "6 Monthly" and
61 - 75 = "3 Monthly"
Tried several IF formula, but nothing working.
Many thanks
Hi Dave,
You can use the following nested If functions:
=IF(A1>60, "3 Monthly", IF(A1>44, "6 Monthly", IF(A1>29, "Yearly", IF(A1>14, "2 Yearly", IF(A1>0, "3 Yearly", "")))))
Hello Svetlana,
I need a Formula with possible 4 options:
If A1="yes" and B1="yes" then use value(€)C4 in field D1
If A1="no" and B1="yes" then use value(€)C3 in field D1
If A1="yes" and B1="no" then use value(€)C2 in field D1
If A1="no" and B1="no" then use value(€)C1 in field D1
Is it possible to help me out?
Kind regards,
Patrick
Hello Patrick,
Here's the formula for D1:
=IF(AND(A1="yes",B1="yes"), C4, IF(AND(A1="no",B1="yes"), C3, IF(AND(A1="yes",B1="no"), C2, IF(AND(A1="no",B1="no"), C1,""))))
Hey Svetlana,
This is the final formula for D1:
=IF(AND(A1="ja";B1="ja");C4;IF(AND(A1="nee";B1="ja");C3;IF(AND(A1="ja";B1="nee");C2;IF(AND(A1="nee";B1="nee");C1;""))))
It won't work with "," only with ";" in the formula.
That's why I couldn't figure out what was wrong earlier...
Does it got anything to do with the version (2013) of excel?
Thanks for your help anyway!
Kind regards
Hi Patrick,
>Does it got anything to do with the version (2013) of excel?
Nope, it depends on what character is set as the List Separator in your Regional Settings (Control Panel > Region and Language > Additional Settings).
Usually comma is the default list separator in North America and some other countries. On my PC it is also the comma and that is why I separated the arguments with ",".
In European countries, comma is used as the decimal symbol and the list separator is usually set to a semicolon, which seems to be your case.
All clear.
Thanks again!
Hi Svetlana,
Good day.
One more help please.
Could you help me, convert (ex: "3days 1hour 25minutes") into minutes. Just to "total minutes" only, so that I can have them rate easily.
Many thanks in advance.
Adzhar
Hi Adzhar,
Check out the following solution: Converting time to minutes in Excel. Hope this helps.
Hi ,
i Want to find out rankin 100 above 1 and 50 above but less 100 2 and below 50 shown 3,
CAE Name TARGET ACHIVEMANT RANKING
GAD GAD %SSO 55%
Sanjay 1300 1101 85
Vikas Tiwari 1200 849 71
Neeraj Tiwari 250 243 97
Sambhunath 300 236 79
Virendra kumar 600 621 104
Kamlesh 200 244 122
Shailendra 450 551 122
Ravi 450 395 88
Sreesh mishra 200 332 166
I am trying to get the following:
in Cell AV756 i have the following string:
=IF(OR(AB756="Bid",Y756>0),Y756,""),IF(OR(AB756="Bid",AA756>0),AA756,"")
If Cell AB756 has the word Bid and If Cell Y756 has a Value return that value in AV756 otherwise leave blank
If Cell AB756 has the word Bid and If Cell AA756 has a value return that value in AV756 otherwise leave blank
I am trying to get thee value from either Y756 or AA756 to populate Cell AV756 if AB756 has the word Bid, only one of the Value cells Y756/AA756 will have a value at any one time.
Hi Svetlana Cheusheva
i need some help with one formula.
i need a formula if i have in cell A1 text "UP" or "OA" or a value <80 to result/display 30 and in the same cell A1 if i have text "STD" or a value <100 to result/display 45
thank in advance
Mihai
Hello MIHAI,
Here you go:
=IF(OR(A1="UP", A1="OA", A1<80), 30, IF(OR(A1="STD", A1<100), 45, ""))
I am unable to paste the exact command here as there seems to be a problem in your website.
Basically if the value in B24 is 0-20, it should be excellent, if it is 20-50, it should be OK, If it is 50-100, it should be subjective, If it is greater than 100, it should be "Over Subjective".
Hello Muhammad,
What you need is nested IF functions like in the following example:
https://www.ablebits.com/office-addins-blog/nested-if-excel-multiple-conditions/
=IF(B24>100, "Over Subjective", IF(B24>50, "Subjective", IF(B24>20, "OK", IF(B24>=0, "Excellent", ""))))
=IF(AND(B24>=0,B24=21,B24=51,B24100,"Over subjectivity"))))
Hi please tell me what am i doing wrong, as whatever value less than 100 in B24 cell is entered. It always gives "Excellent Rating". Basically i am working on automated rating system on daily performance.
=IF(AND(B24>=0,B24=21,B24=51,B24100,"Over subjectivity"))))
Hi, can you please help me??
i want to apply "if formula" in below type of scenario.
if A2 & B2 = BLANK THEN "..." otherwise "...." then again i want to add formula in same formula like a2=blank & b2=not blank then "..." otherwise "..."
Hi, need a formula that will look for numbers either in cells A2 or B2 and if present add the total of A2 and B2 to the number in N1 and show in N2.
Thank you for your help.
Hi Legat,
Here is a formula for N2:
=IF(OR(A2<>"", B2<>""), A2+B2+N1, "")
Hello,
I want to give If formula,
in Perticular Cell if 4 result should be 1, if 8 result 2, like that multiple ive to get. Please assist me on this.
Hello GANESH,
You can use the following nested IF's:
=IF(A1=4, 1, IF(A1=8, 2, ""))
Hi Svetlana,
Is there a shorter way to do this?
=IF(R4>=30,0,IF(R4=29,1,IF(R4=28,2,IF(R4=27,3,IF(R4=26,4,IF(R4=25,5,IF(R4=24,6,IF(R4=23,7,IF(R4=22,8,IF(R4=21,9,IF(R4=20,10,IF(R4=19,11,IF(R4=18,12,IF(R4=17,12,IF(R4=16,12,IF(R4=16,12,IF(R4=15,12,IF(R4=14,12,IF(R4=13,12,IF(R4=12,12,IF(R4=11,12,IF(R4=10,12,IF(R4=9,12,IF(R4=8,12,IF(R4=7,12,IF(R4=6,12,IF(R4=5,12,IF(R4=4,12,IF(R4=3,12,IF(R4=2,12,IF(R4=1,12,IF(R4=0,12))))))))))))))))))))))))))))))))
Hi Svetlana
For question 790 is this correct:
=IF(R4>=30,R4+T4-V4,IF(R4<=29,MIN(R4+T4-V4,30)))
Hi, can you help me with this please?
=IF('6'!$K$8>0, '6'!$K$4, "")
So what I want to achieve is: if K8 in tab 6 is greater than 0, it will show the value in K4 in tab 6, if not blank.
However it is not working, it doesn't take into consideration whether K8>0 or not, it just shows the value in K4 anyway.
Thank you and I appreciate your help!
nvm I got it thank you
Hi Svetlana,
Hope you can help me as I can't find the answer anywhere. Our challenge is for our sick days calendar. We created a spread sheet with 5 tabs from 2016 to 2020. We have changed our system so you can collect only 30 sick days. Some people who have been employed for a long time have more then that and they are allowed to keep adding to their days. So my claculation needs to be if over 30 days keep adding, if they fall under the 30 days in a calendar year they can collect no more then 30 days. Below is my formula for not over 30 but how do I do the first part?
=MIN(C14+E14-G14,30)
Thanks
Is this correct>
=IF(R4>=30,R4+T4-V4,IF(R4=30,0,IF(R4=29,1,IF(R4=28,2,IF(R4=27,3,IF(R4=26,4,IF(R4=25,5,IF(R4=24,6,IF(R4=23,7,IF(R4=22,8,IF(R4=21,9,IF(R4=20,10,IF(R4=19,11,IF(R4=18,12,IF(R4=17,12,IF(R4=16,12,IF(R4=16,12,IF(R4=15,12,IF(R4=14,12,IF(R4=13,12,IF(R4=12,12,IF(R4=11,12,IF(R4=10,12,IF(R4=9,12,IF(R4=8,12,IF(R4=7,12,IF(R4=6,12,IF(R4=5,12,IF(R4=4,12,IF(R4=3,12,IF(R4=2,12,IF(R4=1,12,IF(R4=0,12))))))))))))))))))))))))))))))))
Hope you can help...I'm struggling with this!
I need the result of cell F12 to be this: If E12 is less than 40 then cell F12 is equal to E12 BUT if E12 is greater than 40 then F12 is equal to E12-40.
i hope that makes sense!
Thanks
Hi Michele,
Here you go:
=IF(E12<40, E12, E12-40)
So here is my problem:
=if(E4=L5,G4=M5)
WHY IS THIS NOT WORKING?
So what I am really trying to do is I have a chart and on this chart I have 10 - 100 going by 10's so 10 goes with 133, 20 goes with 263, 30 goes with 407...
so I need to set up a data base where is someone is a 10 another cell automatically shows 133.
Hi,
I am not sure I can follow you regrading the chart. As for your formula, you can enter this one in cell G4:
=IF(E4=L5,M5)
Hi Svetlana,
Could you please help with the following issue.
I need to set a formula for cashflow model. Let say in cell A2 i show cash needed to raise, which depends on cell A1 (net cash), so whenever A1 is negative A2 should show amount needed to raise, however A2 also depends on how much money we have in reserve (acummulated) in A3.So i cannot simply use =if(A1<0;-A1;0), because it is possible that i already have some accumulated cash in reserve from previous months and do not need to raise money from external sourse. So the formula needs to take enough money from reserve and show the rest which is needed to be raised.
I hope my explanation is understandable.
How would I enter:
if cell A is greater than number Y but less than number Z put a 1, otherwise return a blank space?
Hi Mary,
Here you go:
=IF(AND(A1>Y, A1<Z), 1, "")
I need a formula for grades in a spreadsheet. If the reading (G), Math (M), or Science (S) grade is less than 70, the student is "At Risk". Otherwise, the student is "Low Risk". What do I need to change in this formula?
=IF(OR($G5<70, $M5<70, $S5<70), "At Risk", "Low Risk")
Hi, need help with a formula
I need to add P3+R3-T3 into X3 if that number is over 30, i need to display that number, if that number is under 30 I need it to display that number but not go over 30
=IF(C6="","",VLOOKUP(C6,C6:D6,2,0)),IF(C1="A","2%",IF(C1="B","2%"))
please help function not working
note that "" and blank are not the same
if C6 is formula then it should be working, if not then
IF(isblank(C6),"",VLOOKUP(C6,C6:D6,2,0)),IF(C1="A","2%",IF(C1="B","2%"))
is there a way to have the data auto fill from A4 into Cell A3 If the data in A1 matches A2?
Hi Venessa,
You can enter the following formula in A3:
=IF(A1=A2, A4, "")
Hi Svetlana,
Good day. I hope you could help me with my issue.
If 6 or 12 30%discount, if not 0%
pleas upload some educational vedios
Hi there,
I got the first question solve while I was browsing the above comments, thanks by the way.
If I may ask again, Could you please help me how to formulate a formula for the following given figures below. I want to calculate the elapsed time in minutes for each row.
DATE IN TIME IN DATE OUT TIME OUT ELAPSED TIME
15/03/2015 9:49 15/03/2015 10:30 ?
15/03/2015 7:00 15/03/2015 13:30 ?
15/03/2015 8:30 16/03/2015 6:30 ?
15/03/2015 9:00 22/03/2015 8:30 ?
15/03/2015 9:30 20/04/2015 6:30 ?
Many thanks,
Adzhar
lets say A1 = 15/03/2015 10:30 , B1= 15/03/2015 10:30
then C1 will be : =((B1+0)-(A1+0))*24*60
the "+0" trick is really cool once you get used to it, it convert values that have diferent types of representations back to its numeric equivalent.
Next part "*24" turn the value into hours with floating point and the "*60" turn it into minutes.
If you get strange value just correct the format in C1 and you are good to go :)
Hi Svetlana,
Good day. I hope you could help me with my issue.
I want to give a three different ratings for the following figures:
If 0 to 200 = A
If 201 to 800 = B
If greater than 800 and any numbers with a negative signs = C
Many thanks in advance.
Regards,
Adzhar
Hi Adzhar,
Here you go:
=IF(A1>800, "C", IF(A1>200, "B", IF(A1>=0, "A", "C")))
I have set a couple of conditions as follows
Permanent 299 0 300 Yes(E7)
Temporary 3 0 100 Yes(E8)
Final Result: Yes
Even if one of the records is failing i.e its a "No" then the final result should be "No"
For the Final Result I have used the following formulae
=IF(E7="No","No","Yes")
My question is how do I define a range (E7 to E8)
In the above formulae I can only select one particular cell i.e E7
Regards,
Sachin
Hi Sachin,
If the range included only two cells, the easiest way is to use the OR statement, like this:
=IF(OR(E7="No",E8="No"),"No","Yes")
If the range includes several cells, you can use the COUNTIF function, e.g.:
=IF(COUNTIF(E7:E16, "yes")=10, "yes", "no")
Where 10 is the number of cells in the range.
Svetlana,
Thank you for your continued dedication to this thread and the extremely helpful responses you've given to the users thus far!!
If possible, I also have a question that you may be able to assist me on.
I'm utilizing the IF formula as follows:
=IF(D3=40,"110")
It goes on continuously basically for a scale that doesn't mathematically progress properly so I'm doing it individually by each number. My question is, when it returns the value of "110", is there a way for Excel to read that as a number and not text? I'm trying to also incorporate a SUM function but it won't read it as an actual number.
Any insight would be great and thank you again!
Respectfully,
Shon
Hi Shon,
This is because Excel interprets any value enclosed in double quotes as a text string. So, simply remove double quotes and your formula will work just fine:
=IF(D3=40, 110)
Svetlana,
Thank you very much for your insightful assistance and valuable time!
Respectfully,
Shon
Hi,
I am looking for a formula for multiple text. i.e. if bananas, apples and oranges belong to Mr A the result would be Mr A or if potatoes, broccoli and celery the result would be Mr B. Help! Only one column of mixed text with one word per row. Thanks.
I need some help with a formula I am trying to make in a workbook I use for sports tickets. I have a workbook, with a sheet labelled "Cards 2016" that contains all the games with a unique reference of the word “Open” if the tickets haven’t been sold in col E, If col E = “Open” then I want to enter the date from same sheet “Cards 2016” B3 on to a new sheet labelled "Available 2016". If that cell has anything other than "Open", I just want the cell on sheet "Available 2016" to read "Sold"
This obviously didn't work but here is what I thought would work. In a cell on "Available 2016" I put this formula =IF('Cards 2016'!E5="Open";'Cards 2016'!B5),("Sold")
Your best bet is to combine the IF Function with the VLOOKUP, this would allow you to return an exact match i.e the date from sheet "Cards 2016", and if the cell contain anything other than "Open" you can specify "Sold" which will be returned should the condition not met.
https://support.office.com/en-us/article/VLOOKUP-function-0bbc8083-26fe-4963-8ab8-93a18ad188a1
Hope this help
hai,
i want a formula stating if A1=B1 "ok" then A1>B1 "short" A1<B1 "excess"
can you help?
Try this:
=IF(A1=B1,"ok",IF(A1>B1,"short",IF(A1<B1,"excess")))
Hi
just a correction to the above formula
=IF(AND(StaffRates!A4=D4,StaffRates!B4""),StaffRates!B4*G4,0)
Hi,
I am trying to work out staff wages against hours worked. So I have staff names against their rates in a separate worksheet and said names against hours worked I another, so I want to lookup the names then times their respective rates against hours work and populate the earnings column. I am using the following but it only return the zero
=IF(AND(StaffRates!A4=D4,StaffRates!B4""),StaffRates!B4*G4,0)
so:
A4 and D4 holds the names
B4 is the rates
G4 hours worked
Hope this makes sense and thanks for your help.