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 142. Total comments: 4830
Hello,
Looking for an if statement which may not exist. At work we run an SQL that reports locations of specific items. The location field is always xxx-xxx-xx. For example 224-111-03 would be aisle 224, 111th spot, 3rd shelf. I am trying to figure out if I can write an if statement where if the value is between 200-000-00 and 299-999-99, then 1. Or really anyway to manipulate the "224-111-03" so I can work with the locations.
Thanks
Hello Daniel,
You can use both variants. Please specify the one you prefer and we will help you with the formula.
hi,
i have this check list with a checkbox, and i need to know how i can make the question status cell to display a text(done, pending) while changing the cell color (red to green),when i select one of the checkbox answer.
ex. do you have a list of traces on PCB? []yes []no []n/a [question status]
HOW TO USE ROUND OFF COMMENT WITH SUM
i trying to put a formula which searches a specific word from the excell cell string and if ts there then then type "True" or false accordingly.
please help me out over this
Hi, I am creating a spreadsheet to analyse UK horse racing. There are 60 courses under the "Course List" column. In the "Course" column I have listed the meetings taking place each day for the next 12 months, 1175 in total. I am using the following formula in the "Total Meetings" column to extract the number of meetings for each racecourse during the next 12 months
Total Meetings:
=COUNTIF($B$2:$B1176,$D2)
I would now like to add another column which shows the number of meetings remaining after todays races have completed. e.g. if there are 25 meetings in total for a race course, each time a meeting is completed reduce the number of meetings remaining by 1 and display in "Remaining" column next to each course in the "Course List"
RACE DATE COURSE Course List Total Meetings Remaining
1-Feb-15 MUSSELBURGH AINTREE 21
MUSSELBURGH CHELMSFORD CITY 18
2-Feb-15 PUNCHESTOWN LINGFIELD PARK 54
WOLVERHAMPTON SOUTHWELL 60
KEMPTON PARK CHELMSFORD CITY 55
ASCOT AYR 12
BANGOR-ON-DEE 22
MUSSELBURGH 7
Any suggestions please?
Thanks
hi,
I need a help in IF formula.
I have a sheet column AA8 TO AA132 with different due dates, AB column has status as ND,F,WP. I want to change the ND to blank if due date is today.
thanks
hi,
could you please help me on this formula
=IF(AA8=TODAY(), IF(AA8= "ND", ""))
if ND with due date works fine, but any other words LIKE F, WP,CO ETC RESULT SHOWS FALSE
THANKS
VJ
Hello Vijay,
It is difficult to recommend you anything without seeing your data. If you can post your sample workbooks and the result you want to achieve on our forum, our support team will try to help.
I want to highlight one cell of any column When we move the cursor anywhere in the excel sheet. when we will move the cursor up & down then highlight position also move in column only.
ex-
let we choose B column and we work in A,C,D column.
now if we will work in A1 or C1 or D1 cell then B1 cell should be highlight.
if we will work in A3 or C3 or D3 column then D3 should be highlight.
plz give the solution.
Hi,
I was wondering if you could help me. I am trying to format a worksheet where if there is something (in my case columns H, J, L, and N all contain dates) in column H and no value in column I for that same row, the row text turns a different color. Then the same for J to K, L to M, and N to O. Is there an easy way to do this? Maybe I am overthinking? If it's not possible to change the row text color, then just the relative column with the date (H, J, L, N). Thanks!
I am sad that this is not something that can be done. It would make things so much easier.
Hi Gracie,
In fact, you can do this by creating Excel conditional formatting rules. For example, if you want to highlight a row that has a date in column H but no value in column I in the same row, you use this formula:
=AND($H2<>"", $I2="")
Where row 2 is your first row with data (not including the column headers).
Please check out the following tutorial for more details:
How to change the row color based on a cell's value in Excel
This is terrific! I cannot even put into words how helpful this is. Thank you so much!!!!
Hi,
I am doing a project and I need to use the IF function in cell B14 to see if the average in B10 is > the value of each individual average in cells C10,D10,E10, and F10. I tried =IF(B10>C10:F10,"Yes!","No") and =IF(B10>C10,D10,E10,F10,"Yes!","No") both aren't working.
Never mind. I just got it.
I have a table with different tasks and Price of that task. I want to be able to put in a task code and get have a cell read "direct" or "indirect". Would if function work best?
How do you use an If function to count how many characters there are in a cell.
The question is to ask if there are less than four characters in a certain cell?
Hi Kimberly,
You can use the LEN function to count the number of characters in a certain cell, and then you can embed it in the IF function. For example:
=IF(LEN(A1)<4, "good", "bad")
I'm working with a database the puts in new orders at the end of the spread sheet. What I'm trying to do is only bring the "new" entries into another sheet. I've made an identifer of using "1" for new and "0" for old. How would I only display the "1" entries on the workbook? Any help would be greatly apperciated.
I need a formula that will allow me to transfer dates from one page to another.
The first page will be in date format but I need it to correlate on the second page in dated columns as a single X or check-mark.
I would appreciate your assistance.
Thank you,
Hello, i am trying to evaluate between five different columns, in which one of the four columns has a date and two or three of the following columns may or may not have a value. I have tried Isblank but don't get the results. eg: subtract b-a, if b blank then use c-a, if b and c blank then d-a, if b,c,e blank then e-a.
Hey Svetlana
I am dealing with 10000 calls and every call has a time (like 13:56:40)
but I want to count only calls from 8:00:00-17:00:00
I am using =IF(AND(B433>=08:00:00, B433=08:00:00, B433<=17:00:00), "1", "0")
13:36:06 1
18:56:07 0
14:32:26 1
I want it like this but I am not sure what is the mistake with my formula
Hi Jack,
Try this one:
=IF(AND(B2="", C2="", D2=""), E2-A2, IF(AND(B2="", C2=""), D2-A2, IF(B2="", C2-A2, B2-A2)))
Hi,
I've beentrying to fix this sheet i'm working on for a day now. i hope you can help me. what i'm trying to do is if my team will put their name choosing from a drop down list from A1, it should automatically put their employee ID in B2.
please help...
Thanks..
Hi Mark,
Assume that you have master base data where you have all the info about emp name and ID. So from there you can create a employee list by the data validation rule and then put it in A1..then at B1 put this vlookup
formula = Vlookup(A1,Base data range,Column index no,0)...
So when you will put their name choosing from a drop down list from A1, it should automatically put their employee ID in B2.
Hi,
Is it possible to get an if result that shows, in a single result, text and a math result?
=IF(D20<100%,"Dropout to be recovered"(SUM(D18-D19)),"Over target")
After "Dropout to be recovered" I would like to show the amount to be recovered.
Thanks.
Hi Adolfo,
Sure, just use the concatenation operator (&) - "Dropout to be recovered "&SUM()
If you want the text and number to be separated with a space, type a space before the closing quote, like in the example above.
Hi Svetlana, do you have a formula for words of which the column 3 is the final identifier from the given information from columns 1 and 2:
Column 1 Column 2 Column 3
Common Stock Common Stock = Common Stock
Preferred Stock Preferred Stock = Preferred Stock
Rights Common Stock = Common Stock
Rights Rights = Rights
Preferred Stocks Rights = Rights
I'm need to get the following outcomes for multiple scenerios. Here's and example:
If E2=1 then G2="NIC"
If E2=2 then G2="CCM"
If E2=3 then G2="HP/DP"
I want to copy this formula throught a farily large spreadsheet.
never mind I figured it out:
=IF(B1=1,"NIC",IF(B1=2,"CCM",IF(B1=3,"HP/DP")))
I tried this: but it doesn't work: =IF(ISNUMBER(SEARCH("Brigitte",'FY15 Germany & Benelux Projects'!K2:O2)),"X","")
Regarding Example 3. "IF formula for text values with partial match."
I am looking to get the same result but for text values in a RANGE of cells (not just one cell) with partial match.
So if in a range of cells, containing several names in each cell, the name "Brigitte" appears, than I want excel to return an X, if not than I want nothing returned.
I have been looking an dlooking and haven't found the solution so far.
Thanks a lot in advance for your help.
I tried this: but it doesn't work: =IF(ISNUMBER(SEARCH("Brigitte",'FY15 Germany & Benelux Projects'!K2:O2)),"X","")
i have a table basically column A date, column B cash, column c Check. I need to look at column B & C in same row and sum all based on whether column A's year text only, like 2015.so it would give me a total of all payouts in 2015 only. the date column is formatted 1-jul-2015 with multiple years being listed.
date cash check
1-jul-2015 50.00 0
1/jan-2014 0 100
1-feb-2105 0 75
total for 2015 should be 125.00
Hi,
I am looking to match data points along each row in a worksheet.
One column contains values (0-3)
The other column contains values (0-1)
And the last column contains values (1-7)
I want to find a formula that will find out how many times each of these scenarios happen:
-Column one is 3/Column 2 is 0/Column 3 is 1 or 2
-Column one is 2/Column 2 is 0/Column 3 is 3 or 4
-Column one is 1/ Column 2 is 1/Column 3 is 4 or 5
-Column one is 0/ Column 2 is 0/ Column 3 is 5, 6, or 7
Thanks!
Hello,
I need a formula to see if the same name is contained in each column
for example a1 - z1 contains the word accounts receivable
a2 - z2 the word cash
a3 - z3 the word land
and etc.
Any help would be greatly appreciated.
Hi can you help me with this formula, I want to create an "IF" Formula
example :
B C D E
FinDate AgreeDate ActDate Delay Formula
10 31.08.2013 22.08.2014 -356 C10-E10
11 21.09.2013 10.03.2014 13.03.2014 -3 D11-E11
12 30.10.2013 15.04.2015 76 D12-TODAY()
13 30.10.2013 -456 C13-TODAY()
Everything start with act date if blank, check Agree date, then check Fin Date. Final Result is delay ... ( Days )
Thanks
i need to add today's date on one cell if i write a number o letter on another cell some like this. =if(F3=text, "(today()") but i can't make it work.
=if(F3="text", today(),"")
I don't know VBA code. Just a little familiar with basic formulas. I need a simple condition formula that when specific data is entered by user in a cell of one worksheet it will open other worksheets within the workbook. Greatly appreciate any help.
Hi,can you get me a if condition to display the value as 0 with out disturbing the present formula = if(R12>15000,15000*12/100,R12*12/100)
Hi,
can you help me with this formula?
Currently it shows TRUE when I use this formula =RIGHT(A1,8)=D1 want to add below conditions as well accordingly it should show TRUE or FALSE.
If A1 is not blank it should go for =RIGHT(A1,8) = D1 return values should be TRUE
If A1 is blank D1 may be 123 or 456 when d1 falls in 123 or 456 return value should be TRUE when the condition falls out of this scope return values should be FALSE.
Please help me.
Thanks
Hi,
I am trying to create a purchase order that is tied into my existing estimating sheet. I would like the items that are selected in my estimating sheet to transfer over to the Purchase Order Sheet. The IF function that I am looking for will not only calculate $'s but also text in the same line. Is there an easy function that would work out for this.
This is the example that I can add for your reference.
(2) Work Sheets one labeled Estimating Sheet the other is Labeled Purchase Order.
(4) Cells Needed Per Line which are: Quantity, Description, Unit Price, and Total.
Please let me know if there is any thing more that you may need!
Thanks!
i am trying to write a formula. if d7 contains the word late display 1.
Hi Tahsa,
Here you go:
=IF(D7="late", 1, "")
Hi!
I am trying to create a formula which will tell me when two dates in two separate columns do not match. Then if they do not match, what the earliest of the two dates is. Many cells in the second column are blank.
something like =IF(J2=K2,"Yes","No"&J2-K2)
But it only gives me #VALUE
Create a 2 columns, one after each current date column. Convert the columns to a number, not a date. Divide one column by the other. If 1/1 = 1, then all rows with a value of 1 have no difference. If the value isn't one, there is a difference. I'm sure there's a formula, but this little trick works great! I call them "divchecks".
hi,
i have this check list with a checkbox, and i need to know how i can make the question status cell to display a text(done, pending) while changing the cell color (red to green),when i select one of the checkbox answer.
ex. do you have a list of traces on PCB? []yes []no []n/a [question status]
Case Qty (CQ) = 20
Max Level (MQ) = 18
Min Level (MiQ) = 8
Quantity on Hand (QOH) = 5
Reorder Level (ROL) = If(QOH<=MiQ,MQ-MiQ,0)
Reorder Quantity (ROQ) = ?
I want to have ROQ as.... If ROL is Zero then Zero, If ROL is Less than 60% of CQ then CQ, if ROL is greater than 60% of CQ then zero. Pl advice.
Hi Sreedhar
Please let me know if it is working for you...
=IF(ROL=0,0,IF(ROL 0.6*CQ,0)))
I have a cell that contains: Check # 0000
In other words, Check # 0000 - 9999
Can you recommend an If Formula. I have tried
=IF(A1="Deposit","Deposit",IF(A1="Check","Check"))
This works only if I have Check in the cell but with the number sign and numbers it returns a false value. Does anyone have a solution?
Hi William,
Try this one
=IF(A1="Deposit",A1,IF(SEARCH("Check",A1),A1))
Please let me know if it is working...
Hi, Svetlana,
I'm a bit stuck on finding a formula that will suit my needs. My spreadsheet has column A: first name; column B: last name; column C: type of training; column D: date of training.
I need a formula that will look at column A, B, and C and if they match any other row in column A, B, and C I need it to select the most recent date.
this will remove all duplicate training and keep only their most current training record.
Any suggestions? i'm stumped on this one.
is this something you can help me with? i'd really appreciate it. I'm in a time crunch and I have no one else to ask for help.
Hi Amanda,
You can simply sort your table by column D (most recent dates will be at the top), and then use the standard Excel Remove Duplicates tool to find duplicates in columns A, B, C and delete them.
If it is not the case, then send us a small sample workbook with your data at support@ablebits.com including the expected result, and our support team will try to help.
Svetlana,
I'm trying to avoid having to do this manually as the workbook is very large and will continue to get larger. I have emailed you a copy of the workbook as well as what i'm looking for.
Thank you,
Amanda
I want a function which will solve my query as mentioned below.
A B C D E
1 71501 giri 1
1 76597 sekhar 1
1 71503 satish 1
I want value of column C in column E If value of column A and particular value of column B match with value in column D
for example my requirement is column E = "sekhar"
please help.
Svetlana Cheusheva,how can u do, i tell u when i come back..........soonnnnnnn
Hi I want to include a value from a list in my IF formula.
=IF(A18 ="Other" ), D18, (SUM((D18+E18)*F18))
so basically if the value from the list in cell A18 = the word Other (that's a value in the List) I want to display the value in cell D18 if Other is not displayed in A18 then I want the Sum calculation to be done.
Is this possible?
Hi Bel,
Try this one..
=IF(A18="Other",D18,SUM(D18,E18)*F18)
Awesome! Thanks so much for your help Prasenjit!
Alternatively, you can put it in this way:
=IF(A18 ="Other"), D18, (D18+E18)*F18))
Hi,
I need to check the over all strength based on five cell values where each cells have different conditions to meet. It all pass the condition i would say 100%, if any four condition pass, then 75%, similarly for 1 & 2 & 3pass condition. if all fails it is 0%.
For all pass my condition is If(and(a1>=n,a2="Yes", a3<=y, a4z, a5>=100%), 100%, ).
I need to know how to get number of pass criteria and based on that allocating the strength percentage. Is it easy to nested if or need to any other function or method.
Please Suggest.
Regards,
Jai
Hi Jai,
If the Pass criteria can be used in any order, e.g. 1st, 3rd and 5th, then you'd better use the CHOOSE function:
=CHOOSE((IF(A1>4,1,0)+IF(A2="Yes",1,0)+IF(A3<3,1,0)+IF(A4>=6,1,0)+IF(A5=100%,1,0)),0%,20%,40%,50%,75%,100%)
Just change the conditions for each cell as you want.
The principle is as follows: each IF statement returns either 1 or 0 depending whether the conditions are met or not. The sum of the IFs' results varies from 0 to 5.
The CHOOSE function returns 0%,20%,40%,50%,75%,100% (you can also modify this part if needed) according to the sum of the IF functions' results.
Thanks...I got the solution................
Hi, I want to enter a formula for the following situation:
If the cell contains specific text, then calculate x-y, otherwise x
I was trying if(B1="text",A1-D1,A1) but it is not working
Hi Chacon,
The formula looks correct, I don't see any reason for it not working. You can try it on a blank sheet and you will see it does work. Maybe the problem is in the source data?
In a specific cell I am wanting it to tell me If a Response is LESS than 28 days old it is Outstanding & If it is MORE than 28 days old it is Overdue (this I can do) BUT I also want it to tell me if another cell on the same sheet contains 'Yes' it overides the previous command and that cell needs to read Complete but if that cell is blank it will ignore the rule. At the minute I have this:- =IF((E3-B7)>28,"Overdue","Outstanding"),IF(M9="Yes","Complete","0")
Hi Jen
Try this one
=IF(M9="Yes","Complete",IF((E3-B7)>28,"Overdue","Outstanding"))
I want to calculate age between 0-14, 15-24, 25-59 and 70+ from single age registered over the months in input sheet to analysis sheet. I want to know the formula;
the logic is if a person of 24 age is registered in January, 2014 then it should be counted in 14-24 age group in analysis sheet.
Thanks
You can calculate it using the COUNTIF function.
Here are the formulas to count age 14 – 24.
If dates are entered as text, e.g. " January, 2014":
= COUNTIFS($A$2:$A$100, "<=24", $A$2:$A$100, ">=14", $B$2:$B$100, "January, 2014")
If the date is formatted like this 1/10/2014, please use this formula:
=COUNTIFS($A$2:$A$100, "<=24", $A$2:$A$100, ">=14", $B$2:$B$100, "<=1/31/2014", $B$2:$B$100, ">=1/11/2014")
if a1>20 and b1> 50 add a1+b1 if if a1<20 and b1< 50 do nothing
please i need help on that
Hi Shabtom,
Here you go:
=IF(AND(A1>20, B1<50), A1+B1, "")
A B C D
1 a:5 b:4 a:26 b:3
2 a:4 b:45 a:6 b:18
3 M3 a:50 b:40 a:26 b:30
how to use IF function on above data. i want to print:
1) let's say, if the number after the colon [:] equal or more than 5, then just print "a" or "b"
2)if the number after the colon [:] is less than 5 then print "X".
Sorry, I am not sure I can follow you. Can you try to explain in other words?
Hi, Svetlana,
I'm a bit stuck on finding a formula that will suit my needs. My spreadsheet has column A: first name; column B: last name; column C: type of training; column D: date of training.
I need a formula that will look at column A, B, and C and if they match any other row in column A, B, and C I need it to select the most recent date.
this will remove all duplicate training and keep only their most current training record.
Any suggestions? i'm stumped on this one.
If it helps, I can certainly send you a copy of the workbook that I'm trying to do this in.
I have following formula but it writes the result as only A even condition not satisfied
=IF(F4="","",IF(ISERROR(VLOOKUP($D$4,Sheet5!D:D,4,0)),"A","B"))
Please Help me
Hi Kumar,
First off, please check the VLOOKUP range. Currently it contains just one column (D) and naturally Excel returns an error. You probably meant:
VLOOKUP($D$4,Sheet5!D:G,4,0)
hi i am not sure if i will explain it correct but i need help i need a formula to say if c2>d2 then true 3 false 0 and if c2=d2 then true 1 false 0
thanks very much
Hi!
Try this one:
=IF(C2>D2, 3, IF(C2=D2, 1, 0))
I am trying to come up with an IF statement that put a name only if the column to the left of it is not blank. However, there are formulas in the columns to the left that make some of them look blank, even though the actual cell is not blank. What formula can I use to return a blank if the cell has a formula, but is blank?
I started with this, but I don't know how to exclude the formula.
=IF(ISBLANK(B8)," ","Clarence")
Hi Janna,
If my understanding of the task is correct, replacing ISBLANK(B8) with B8="" should work a treat:
=IF(B8=""," ","Clarence")
is there a way to concatenate more than 3 IF functions
Sure, you can include as many as you want as long as the total number of arguments in the formula does not exceed 255.
You can find more info about the the CONCATENATE function as well as other alternatives to nested IF in the following article:
https://www.ablebits.com/office-addins-blog/excel-if-function-multiple-conditions/
i will try my best to explain......let's say we have 1,500 users in c25
Heading:
Login's per Month............................Fee
e25 = 1-1999 ..........................f25 = $10.00
e26 = 2,000 - 4,999....................f26 = $6.00
e27 = 5,000 - 9,999....................f27 = $4.00
if c25 is between 1 and 1999 logins how do we make c28 = f25 or $10.00
if c25 is between 2,000 and 4,999 logins how do we make c28 = f26 or $6.00
if c25 is between 5,000 and 9,999 logins how do we make c28 = f27 or $4.00
We would like to plug the number into c25 and then c28 will change to what ever the fee is.
thank you soooooooo much
LC3
I think you can concatenate 3 IF functions in this way:
=IF(AND(C25>=1, C25<=1999), F25, "") &IF(AND(C25>1999, C25<=4999), F26, "") &IF(AND(C25>4999, C25<=9999), F27, "")
Please note that if a value in cell C28 is outside of 1-9,999 range, the formula will return an empty string.
Thank Svetlana... This conversation was a great help for me.
Excellent, THANK YOUUUUUUUUUUUUUU
i'm very new at this I preformed a If and put it into cell c28 and got no return, I do put the formula in where I want the change to occur correct?
You put the formula in the cell where you want the result to appear.