In this article, you will learn how to build an Excel IF statement for different types of values as well as how to create multiple IF statements.
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.
In this tutorial, we are going to learn the syntax and common usages of the Excel IF function, and then take a closer look at formula examples that will hopefully prove helpful to both beginners and experienced users.
IF function in Excel
IF is one of logical functions that evaluates a certain condition and returns one value if the condition is TRUE, and another value if the condition is FALSE.
The syntax of the IF function is as follows:
As you see, IF takes a total of 3 arguments, but only the first one is obligatory, the other two are optional.
Logical_test (required) - the condition to test. Can be evaluated as either TRUE or FALSE.
Value_if_true (optional) - the value to return when the logical test evaluates to TRUE, i.e. the condition is met. If omitted, the value_if_false argument must be defined.
Value_if_false (optional) - the value to return when the logical test evaluates to FALSE, i.e. the condition is not met. If omitted, the value_if_true argument must be set.
Basic IF formula in Excel
To create a simple If then statement in Excel, this is what you need to do:
- For logical_test, write an expression that returns either TRUE or FALSE. For this, you'd normally use one of the logical operators.
- For value_if_true, specify what to return when the logical test evaluates to TRUE.
- For value_if_false, specify what to return when the logical test evaluates to FALSE. Though this argument is optional, we recommend always configuring it to avoid unexpected results. For the detailed explanation, please see Excel IF: things to know.
As an example, let's write a very simple IF formula that checks a value in cell A2 and returns "Good" if the value is greater than 80, "Bad" otherwise:
=IF(B2>80, "Good", "Bad")
This formula goes to C2, and then is copied down through C7:
In case you wish to return a value only when the condition is met (or not met), otherwise - nothing, then use an empty string ("") for the "undefined" argument. For example:
=IF(B2>80, "Good", "")
This formula will return "Good" if the value in A2 is greater than 80, a blank cell otherwise:
Excel If then formula: things to know
Though the last two parameters of the IF function are optional, your formula may produce unexpected results if you don't know the underlying logic.
If value_if_true is omitted
If the 2nd argument of your Excel IF formula is omitted (i.e. there are two consecutive commas after the logical test), you'll get zero (0) when the condition is met, which makes no sense in most cases. Here is an example of such a formula:
=IF(B2>80, , "Bad")
To return a blank cell instead, supply an empty string ("") for the second parameter, like this:
=IF(B2>80, "", "Bad")
The screenshot below demonstrates the difference:
If value_if_false is omitted
Omitting the 3rd parameter of IF will produce the following results when the logical test evaluates to FALSE.
If there is just a closing bracket after value_if_true, the IF function will return the logical value FALSE. Quite unexpected, isn't it? Here is an example of such a formula:
=IF(B2>80, "Good")
Typing a comma after the value_if_true argument will force Excel to return 0, which doesn't make much sense either:
=IF(B2>80, "Good",)
The most reasonable approach is using a zero-length string ("") to get a blank cell when the condition is not met:
=IF(B2>80, "Good", "")
Tip. To return a logical value when the specified condition is met or not met, supply TRUE for value_if_true and FALSE for value_if_false. For the results to be Boolean values that other Excel functions can recognize, don't enclose TRUE and FALSE in double quotes as this will turn them into normal text values.
Using IF function in Excel - formula examples
Now that you are familiar with the IF function's syntax, let's look at some formula examples and learn how to use If then statements in real-life scenarios.
Excel IF function with numbers
To build an IF statement for numbers, use logical operators such as:
- Equal to (=)
- Not equal to (<>)
- Greater than (>)
- Greater than or equal to (>=)
- Less than (<)
- Less than or equal to (<=)
Above, you have already seen an example of such a formula that checks if a number is greater than a given number.
And here's a formula that checks if a cell contains a negative number:
=IF(B2<0, "Invalid", "")
For negative numbers (which are less than 0), the formula returns "Invalid"; for zeros and positive numbers - a blank cell.
Excel IF function with text
Commonly, you write an IF statement for text values using either "equal to" or "not equal to" operator.
For example, the following formula checks the Delivery Status in B2 to determine whether an action is required or not:
=IF(B2="delivered", "No", "Yes")
Translated into plain English, the formula says: return "No" if B2 is equal to "delivered", "Yes" otherwise.
Another way to achieve the same result is to use the "not equal to" operator and swap the value_if_true and value_if_false values:
=IF(C2<>"delivered", "Yes", "No")
Notes:
- When using text values for IF's parameters, remember to always enclose them in double quotes.
- Like most other Excel functions, IF is case-insensitive by default. In the above example, it does not differentiate between "delivered", "Delivered", and "DELIVERED".
Case-sensitive IF statement for text values
To treat uppercase and lowercase letters as different characters, use IF in combination with the case-sensitive EXACT function.
For example, to return "No" only when B2 contains "DELIVERED" (the uppercase), you'd use this formula:
=IF(EXACT(B2,"DELIVERED"), "No", "Yes")
If cell contains partial text
In situation when you want to base the condition on partial match rather than exact match, an immediate solution that comes to mind is using wildcards in the logical test. However, this simple and obvious approach won't work. Many functions accept wildcards, but regrettably IF is not one of them.
A working solution is to use IF in combination with ISNUMBER and SEARCH (case-insensitive) or FIND (case-sensitive).
For example, in case "No" action is required both for "Delivered" and "Out for delivery" items, the following formula will work a treat:
=IF(ISNUMBER(SEARCH("deliv", B2)), "No", "Yes")
For more information, please see:
Excel IF statement with dates
At first sight, it may seem that IF formulas for dates are akin to IF statements for numeric and text values. Regrettably, it is not so. Unlike many other functions, IF does recognize dates in logical tests and interprets them as mere text strings. In other words, you cannot supply a date in the form of "1/1/2020" or ">1/1/2020". To make the IF function recognize a date, you need to wrap it in the DATEVALUE function.
For example, here's how you can check if a given date is greater than another date:
=IF(B2>DATEVALUE("7/18/2022"), "Coming soon", "Completed")
This formula evaluates the dates in column B and returns "Coming soon" if a game is scheduled for 18-Jul-2022 or later, "Completed" for a prior date.
Of course, there is nothing that would prevent you from entering the target date in a predefined cell (say E2) and referring to that cell. Just remember to lock the cell address with the $ sign to make it an absolute reference. For instance:
=IF(B2>$E$2, "Coming soon", "Completed")
To compare a date with the current date, use the TODAY() function. For example:
=IF(B2>TODAY(), "Coming soon", "Completed")
Excel IF statement for blanks and non-blanks
If you are looking to somehow mark your data based on a certain cell(s) being empty or not empty, you can either:
- Use the IF function together with ISBLANK, or
- Use the logical expressions ="" (equal to blank) or <>"" (not equal to blank).
The table below explains the difference between these two approaches with formula examples.
Logical test | Description | Formula Example | |
Blank cells | ="" |
Evaluates to TRUE if a cell is visually empty, even if it contains a zero-length string. Otherwise, evaluates to FALSE. |
=IF(A1="", 0, 1)
Returns 0 if A1 is visually blank. Otherwise returns 1. If A1 contains an empty string (""), the formula returns 0. |
ISBLANK() |
Evaluates to TRUE is a cell contains absolutely nothing - no formula, no spaces, no empty strings. Otherwise, evaluates to FALSE. |
=IF( Returns 0 if A1 is absolutely empty, 1 otherwise. If A1 contains an empty string (""), the formula returns 1. |
|
Non-blank cells | <>"" | Evaluates to TRUE if a cell contains some data. Otherwise, evaluates to FALSE.
Cells with zero-length strings are considered blank. |
=IF( Returns 1 if A1 is non-blank; 0 otherwise. If A1 contains an empty string, the formula returns 0. |
ISBLANK() |
Evaluates to TRUE if a cell is not empty. Otherwise, evaluates to FALSE.
Cells with zero-length strings are considered non-blank. |
=IF( Works the same as the above formula, but returns 1 if A1 contains an empty string. |
And now, let's see blank and non-blank IF statements in action. Suppose you have a date in column B only if a game has already been played. To label the completed games, use one of these formulas:
=IF(B2="", "", "Completed")
=IF(ISBLANK(B2), "", "Completed")
=IF($B2<>"", "Completed", "")
=IF(ISBLANK($B2)=FALSE, "Completed", "")
In case the tested cells have no zero-length strings, all the formulas will return exactly the same results:
Check if two cells are the same
To create a formula that checks if two cells match, compare the cells by using the equals sign (=) in the logical test of IF. For example:
=IF(B2=C2, "Same score", "")
To check if the two cells contain same text including the letter case, make your IF formula case-sensitive with the help of the EXACT function.
For instance, to compare the passwords in A2 and B2, and returns "Match" if the two strings are exactly the same, "Do not match" otherwise, the formula is:
=IF(EXACT(A2, B2), "Match", "Don't match")
IF then formula to run another formula
In all of the previous examples, an Excel IF statement returned values. But it can also perform a certain calculation or execute another formula when a specific condition is met or not met. For this, embed another function or arithmetic expression in the value_if_true and/or value_if_false arguments.
For example, if B2 is greater than 80, we'll have it multiplied by 7%, otherwise by 3%:
=IF(B2>80, B2*7%, B2*3%)
Multiple IF statements in Excel
In essence, there are two ways to write multiple IF statements in Excel:
- Nesting several IF functions one into another
- Using the AND or OR function in the logical test
Nested IF statement
Nested IF functions let you place multiple IF statements in the same cell, i.e. test multiple conditions within one formula and return different values depending on the results of those tests.
Assume your goal is to assign different bonuses based on the score:
- Over 90 - 10%
- 90 to 81 - 7%
- 80 to 70 - 5%
- Less than 70 - 3%
To accomplish the task, you write 3 separate IF functions and nest them one into another like this:
=IF(B2>90, 10%, IF(B2>=81, 7%, IF(B2>=70, 5%, 3%)))
For more formula examples, please see:
Excel IF statement with multiple conditions
To evaluate several conditions with the AND or OR logic, embed the corresponding function in the logical test:
For example, to return "Pass" if both scores in B2 and C2 are higher than 80, the formula is:
=IF(AND(B2>80, C2>80), "Pass", "Fail")
To get "Pass" if either score is higher than 80, the formula is:
=IF(OR(B2>80, C2>80), "Pass", "Fail")
For full details, please visit:
If error in Excel
Starting from Excel 2007, we have a special function, named IFERROR, to check formulas for errors. In Excel 2013 and higher, there is also the IFNA function to handle #N/A errors.
And still, there may be some circumstances when using the IF function together with ISERROR or ISNA is a better solution. Basically, IF ISERROR is the formula to use when you want to return something if error and something else if no error. The IFERROR function is unable to do that as it always returns the result of the main formula if it isn't an error.
For example, to compare each score in column B against the top 3 scores in E2:E4, and return "Yes" if a match is found, "No" otherwise, you enter this formula in C2, and then copy it down through C7:
=IF(ISERROR(MATCH(B2, $E$2:$E$4, 0)), "No", "Yes" )
For more information, please see IF ISERROR formula in Excel.
Hopefully, our examples have helped you get a grasp of the Excel IF basics. I thank you for reading and hope to see you on our blog next week!
Practice workbook
Excel IF statement - formula examples (.xlsx file)
4763 comments
I need help with a formula using dates:
What I am trying to accomplish is if cell G2< 7/1/14 then insert 7/1/14 but if not insert the date that is in G2.
=IF(G2<DATEVALUE("7/1/2014"),"7/1/2014",G2)
Thanks for any help,
Hi Monica,
Your formula is correct. If it returns a serial number rather than a date, you should simply apply the Date format to the cell (press Ctrl+1 to open the Format Cell dialog and select the Date format you want).
Can you help me with this formula:
=IF(AND(AE303="",AK303=""),Incident),IF(AND(AE303""),AK303="",(NOW()-(AE303))),(DATEDIF(AE303,AK303,"D")))
I am trying to have the formula:
(1) if cell AE303 and AK303 are both blank put in the word "Incident", but
(2) if cell AE303 has a date in the cell and AK303 is blank insert number of days between AE303 and Today, but
(3)if both cells have dates, subtract them and tell me the # of days between
Hi Lana,
Try this formula:
=IF(AND(AE303="",AK303=""), "Incident", IF(AND(AE303<>"",AK303=""), TODAY()-AE303, IF(AND(AE303<>"", AK303<>""), DATEDIF(AE303,AK303,"D"))))
Just keep in mind please that DATEDIF requires the start date (AE303) to be always less than the end date (AK303), otherwise a formula will return the NUM! error. An easy workaround is simply subtracting one date from the other in the last value_if_false argument:
AK303-AE303
I'm attempting a similar formula as step (2) noted in Lana's question but I cannot get it to work.
The sheet has set due dates for a task to be done. There is a column for the completed date (C) and the days overdue (D) based on the due date.
I'm trying to get the number of days overdue to show in column D (due date is in C2) if there is not a completed date in C, otherwise if there is a date in C, I'd like the cell to stay blank.
Tried this formula, but it shows as FALSE when there is a date in C instead of coming up blank:
=IF(AND(C5=""), TODAY()-$C$2)
[Row 5 is the first row of data excluding the due date in row 2, so I'm intending on dragging down the remaining rows]
Hopefully you can help me with this!
Hi!
I’m not sure I got you right since the description you provided is not entirely clear. However, it seems to me that the formula below will work for you:
=IF(C5="", TODAY()-$C$2,"")
i need a formula to display a number (2) if the cell says "yes" and display a (4) if the cell says "no"....
can anyone help?
Here you go:
=IF(A1="yes", 2, IF(A1="no", 4, ""))
i cannot figure the formula out help!!!
In cell F20, enter an IF function that tests whether the order quantity in cell E20 is greater than zero. If it is, return the the charge for this item, which is the value of cell E20 mulitplied by cell D20. Otherwise, return a space by entering " " (that is, double quote, space, double quote). Autofill this formula into the range F21:F25.
Hi Ana,
Here's the formula for F20:
=IF($E20>0, $E20*$D20, " ")
Simply copy it down to other cells in column F:
- select cell F20;
- move the mouse cursor at the lower right-hand corner of the cell and you will see it changing to a plus sign (fill handle);
- click the plus and drag it down to fill other cells with your formula.
I have a tricky question...I want sheet 2 to return an if statement that calculates on sheet 1.: =if(MaterialBreakdown[SARA Title 313}="*YES", MaterialBreakdown[Material Name], NA. That is the formula I tried to use, but it gave me an error. I want all materials in column A to list in another sheet if they have yes in column C. I am really bad at explaining this!
all help appreciated!
I NEED YOUR HELP IN THIS FORMULA:
=IF(K26="CHEMICAL TANKER",IF(AND(K26>=0,K26=5000,K26=10000,K2620000,550))))),IF(K26="GENERAL CARGO",IF(AND(K26>=0,K26=5000,K2610000,490))))
THE ANSWER IS= #VALUE
IS THERE ANY POSSIBILITY TO COMBINE MORE THAN ONE IF STATEMENT IN ONE CELL?
I WANT TO ADD OTHER IF CONDITIONS IE,"BULK","CARGO" AND SO ON.
IS THERE ANY LIMITATION FOR THIS CONDITION? TQ
What if I want to say if cells F1, G1, and H1 are blank, I1 should be blank. If F1, G1 and H1 have numbers, then I1 should be F1+G1+H1.
Hi James,
Should I1 be blank if any of cells F1, G1, and H1 is blank or if all 3 cells are blank?
And what if any of those cells contains a text value?
Hi,
I have two membership type groups; member and non-member (column A). I have registration start dates (column B) and registration end dates (column C). I need to confirm that the start and end dates for registration fall within the acceptable date range for both members and non-members. Members range (6/1/15 – 8/31/15); Non-Members (6/8/15 – 8/31/15).
Thanks!
Hi Guys, how are you?
I imported data from TXT file when the field BDATE came like below:
09/09/2013
09/09/2013
09/09/2013
09/09/2013
30/12/2011
14/03/2013
24/09/2013
24/09/2013
30/12/2011
This format is British style (DD/MM/YYYY), when I convert to American style (MM-DD-YYYY) the date that begin > 12 were not converted.
Somebody knows what to do?
Thanks!
Hi
Need to insert if formula where there are four dates (one in each column) and need a yes answer if any of the dates are greater than one date but less than another date. eg. if any of the four dates were greater than 01/06/15 but less than 30/06/15 I need the answer to be yes
Thanks. LP
Lindsay,
Please use this formula:DATEVALUE("01/06/15")), AND(A2DATEVALUE("01/06/15")), AND(A3DATEVALUE("01/06/15")), AND(A4DATEVALUE("01/06/15"))), "Yes","")
=IF(OR(AND(A1
Where A1, A2, A3, A4 are cells with the dates.
Hi Svetlana,
What is the formula to highlight non-date cell on particular future dates?
e.g.
A1 cell contains Name and I want to highlight this name between 20 May 2015 to 22 May 2015.
Can you please, help me with the formula for this?
Regards,
Sid.
How to set if condition for following:
=ROUND(VLOOKUP(G6,'2012 IAM Table raw'!A$2:D$122,4,FALSE)*((1-VLOOKUP(G6,'2012 IAM Table raw'!A$2:E$122,5,FALSE))^F6),3)/1000
this round value will return some value, if values is not return need to set the field value to 0 (zero)
Hi Harish,
You can try to wrap your VLOOKUP function with IFERROR like this:
=ROUND(iferror(VLOOKUP(G6,'2012 IAM Table raw'!A$2:D$122,4,FALSE) * ((1-VLOOKUP(G6,'2012 IAM Table raw'!A$2:E$122,5,FALSE))^F6), 0), 3)/1000
Dear Svetlana,
I tried =TEXT(O2,"dd-mmmm-yy") and which (O2)=IF(B2="delivered", TODAY(), "")
it workeed yesterday and (cell P2) shown 12-May-15 but it updated to 13-May-15 today morning.
So how to lock the date(cell P2) at 12-May-15?
thank you.
Hi Zhao,
Regrettably, it's not possible to lock the date using formulas. You either have to replace the formula with its value each time manually (Copy > Paste Special > Value) or write a VBA script that automates this.
For some reason, every time I submit my question, it cuts down on how I originally wrote my formula.
=IF(AND(A1>=1,A1=5,A1<10),5,10))
This will only return the number 10.
Hi Eric,
Our blog engine often mangles formulas in comments, sorry for this. Could you please describe your conditions in words, so that I can understand the logic? So, the formula should return:
5 if ?
10 if?
1 if?
Hi, I am trying to write a formula that pulls in a number of 1, 5 or 10. The numbers in cell A1 range anywhere from 1 - 25. I presently have it set up as follows:
=IF(AND(A1>=1,A1=5,A1<10),5,10))
The formula takes, but it only returns the number 10 in all instances. Help!!
Hi, I am trying to write a formula that pulls in a number of 1, 5 or 10. The numbers in cell A1 range anywhere from 1 - 25. I presently have it set up as follows:
=IF(AND(A1>=1,A1=5,A1<10),5,10))
The formula takes, but it always returns the number 10 in every instance. Can't figure this out. Hoping you can help.
Hi, working on an excel spreadsheet for invoices.
Column A is quantity, b & c are description, D is unit price and E total
I need a formula that calculates A*D in column E but remains blank when column A is blank
Thank you
Hi Fitz,
Try the following formula:
=IF(A2<>"", A2*D2, "")
awesome. perfect. thank you Svetlana
if the same way I want to get "Yes" if value greater than A1, else remain blank. Also if there is no value in A1 still remains blank
=IF(B2="delivered", TODAY(), "")
I use this formula to generate delivery date, but i found that the date will updated to the date of next day... So how to maintain the date there for me to check the delivery date few days later? thanks.
hi..
i have just got answer from your previous post that
"How to convert date to text using Excel TEXT function and no-formula ways"
...ha, it`s helpful, thank you very much, but i am not sure whether it will be updated tomorrow
=IF(CV2<=28,"Poor", IF(28<CV2<=42,"Borderline","Acceptable"))
I wrote the formula above but it's only selecting "Poor" and "Acceptable", leaving out "Borderline" Any help?
Hi Phil,
Regrettably IF cannot understand expressions like 28<CV2<=42. You have to use an AND statement is this case:
=IF(CV2<=28,"Poor", IF(AND(CV2>28, CV2<=42),"Borderline","Acceptable"))
But in fact, checking for CV2>28 is superfluous and you can put it simply as:
=IF(CV2<=28,"Poor", IF(CV2<=42,"Borderline","Acceptable"))
Friends I want to a formula who auto calculate with given material with its value.
Ex.
If Material is Sand and its value 41....its divided by its net weight(12000)
I want to just type different Materials Name like sand and its auto divided with weight.
PER GRADE GRADE points
66.5 C
80 B
90 A
65 D
if A=4 ,B=3.5 ,C=3 ,D=2 HOW CALCUATE (FORMULA)
hi I want to find a value if a1=less then 20 "80" more then 20 bt less then 40 then calculate(a1-20)*7)+80) bt a1 is greater then 40 then calculate (a1-40)*10)+230 please help me ma
I have an if function question I can't seem to find a similar question in your article. For example Tenant lease start D12 and lease end dates E14; has to give me the date in G14. The same date that is in D12. This tell me when I can start doing improvements. How is the if function written out?
Hii...
I need a help, question is
PF is 20% of Basic salary or Rs.1000 whichever is less
Please give me answer as soon as possible.
Hi I would like to ask how do I type in the formula box if for example I want it the multiplier to be like this:
If the value ranges from:
1 ~ 10 = 150
10.1 ~ 50 = 120
50.1 ~ 250 = 110
251.0 ~ 500 = 100
501.0 ~ 750 = 95
751 ~ 1000 = 90
If I have typed a value of 57, it should be 57 * 110 (since 57 is at range of 20.1 ~ 250 = 150 (150 as the multiplier))
Please help.
Thanks
Thanks Svetlana
I didn't see your reply but thank you for answering
All is Ok, I have managed to solve the problem by using SUMIF.
I have a column of repeated names and a column of values against the names say C2:C101 (names) and I2:I101 (values). I have tried to work out a formula that looks for one of the names in column C and gives a total of all corresponding values in column I.
I have tried variations of =IF(C2-C101="Walker, David","SUMI2-I101","0") but I just cannot get it to work.
Can you help please.
Thank You
Microsoft Excel has a special SUMIF function for this purpose, which makes the formula as simple as:
=SUMIF(C2:C101, "Walker, David", I2:I101)
Hi, looking to do the following:
Cell C1 has mobile #
Cell D1 has mobile # or is blank
- we insert rows manually below each data entry which has values in C1 and D1 (throughout the sheet)
- if there is an easier way, please advise
I now want to have the value of the newly created row reflect the value of D1 if there is data in D1; but
I want to be in a position to drag the formula through the whole sheet and there won't be rows inserted below data entries that doesn't have values in D1; thus
I want those data entries to remain the same.
My problem is that it creates a circular reference.
Virgin sheet ex.
A B C D
1 Dave Scott 0845685841 0824865892
2 Jill May 0725984287
3 Jhon Snmit 0605493216 0915876431
Manually insert row below person with 2 numbers
A B C D
1 Dave Scott 0845685841 0824865892
2 xxx xxxxx xxxxxxxxxx xxxxxxxxxx
3 Jill May 0725984287
4 Jhon Snmit 0605493216 0915876431
4 xxx xxxxx xxxxxxxxxx xxxxxxxxxx
Thus I want to be able to do the following:
Input a formula in column C to display the value of D in the above row or remain the same if D is blank
What I tried, but gave me circular reference:
In C2 =IF(D1"",D1,C2)
The same will apply to the names, will also want to be able to populate the persons name in the newly created row for their second number:
In A2 =IF(D1"",A1,A2)
The result that we are looking for is:
A B C D
1 Dave Scott 0845685841 0824865892
2 Dave Scott 0824865892 xxxxxxxxxx
3 Jill May 0725984287
4 Jhon Snmit 0605493216 0915876431
4 Jhon Snmit 0915876431 xxxxxxxxxx
Therein lies my problem, kindly advise
I am trying to design a function to produce a "grade" based on a number of columns.
There are three possible grades given: UNSAT, SAT, SUP
There are eight graded sections(columns), each with one of the given grades above.
I want the ninth section to produce an OVERALL grade based on the previous grades.
SUP on 7 or 8 of the previous eight grades (columns)
UNSAT on 2 or more of the previous eight grades (columns)
SAT in all other cases.
Thanks for any help you can provide!
Never mind! I found the answer by using a mixture of IF and COUNTIFS Functions:
=IF(COUNTIF(A24:G24,"SUP")<7,"SAT","SUP")
This answer actually nullifies the requirement to have an UNSAT answer in the field, only because it was easier for me to count an UNSAT manually vice work the multitude of function. If i do find a better answer (to my own question haha) I will update it!
THANK YOU Svetlana, this was exactly the help I needed!
Oh, Svetlana! I am forever indebted to you!!! THANK YOU so very much for the formula! It worked perfectly!! I cannot tell you how grateful I am for your help!
Oh, dear! Can anyone please help?!?
I have been working on finding a formula to work in a spreadsheet and can't find the correct one to produce the results I need.
I want to say: IF C6=X,or C7=X, or C8=X, or C9=X, or C10=X, or C11=X, or C12=X, or C13=X, THEN C4=X.
Every time I try using an IF statement or an OR statement, it doesn't work properly and it says my formula is broken.
Does anyone know what the correct formula would be for this? I have spent hours using tutorials and working out formulas but still can't get this to work. ANY help would be greatly appreciated!!
Hi Julie,
Try entering one of the following formulas in cell C4.
If X is a text value:
=IF(OR(C6="X", C7="X", C8="X", C9="X", C10="X", C11="X", C12="X", C13="X"), "X", "")
If X is a number, say 1:
=IF(OR(C6=1, C7=1, C8=1, C9=1, C10=1, C11=1, C12=1, C13=1), 1, "")
Hi Svetlana,
I have two problems I can't solve. I hope you can help me!
I have a value in Column D. I want to subtract that value from 20. If the result is 0 or less, I want Column J to show 0. If the result of 20-D is greater than 0, I want to display that value.
For example:
The value in D4 is 22, 20-22 = -2, therefore J4 shows "0".
The value in D4 is 14, 20-14 = 6, therefore J4 shows "6".
Here is the formula I have in Column J: IF(SUM(20-D4)=0,),"0",(SUM(20-D4)
It doesn't work.
Also, I have a value in Column F. If the value in Column F4 is equal to 100, then Column L4 should show 5. If the value in Column F4 is between 90 and 99, Column L4 should show 4. If Column F4 is between 80 and 89, Column L4 should show 3. If the value in Column F4 is between 70 and 79, Column L4 should show 2. If Column F4 is between 60 and 69, Column L4 should show 1. If the value in Column F4 is equal to or less than 59, Column L4 should show 0.
For example: The value in Column F4 is 87, therefore Column L4 shows "3".
I don't understand how to write this formula either. I am new to formulas in Excel and I don't understand the syntax.
Hi Kathleen,
Here is the first formula:
=IF(20-D4<=0, 0, 20-D4)
As for the second task, you need nested IF's here:
=IF(F4=100, 5, IF(F4>=90, 4, IF(F4>=80, 3, IF(F4>=70, 2, IF(F4>=60, 1, 0)))))
I hope these are the formulas you are after :)
dear all
please clear the following detail.....
stock Value RATE physical
44 1872 43 44
if physical and stock is equecl print the value 0 and physical value 45 into the rate value and physical value 43 into the rate, so clear the urgent basis.
regard
If A1 in sheet1 contains "AAB00001-A3" and A5 has 45
A2 in sheet1 contains "AAB00001-A4" and A5 has 54
I want add 45 with 54 using IF function Comparing A1 and A2 with "AAB00001" which is there in other sheet and cell.
Please help.
I wanted to use if function of changing last digit of 3 digit number.
example: 102, 103, 104, 105, 106
2 is admin
3 is HR
4 is Finance
5 is research
6 is field staff
Hi Ms. Svetlana,
Can you help me on this?
IF today's date, range from 1 to 15; my date input should be mm/15/yyyy in a cell.
But IF 16 - 31; date input should be mm/30/yyyy.
I have formula but not working properly:
=IF(DATE(YEAR(TODAY()),MONTH(TODAY()), TODAY())>15, DATE(YEAR(TODAY()),MONTH(TODAY()),30), DATE(YEAR(TODAY()),MONTH(TODAY()),15))
Hope you can help.
Many Thanks!
Hi Gibson,
Try this one:
=IF(DAY(TODAY())<15,DATE(YEAR(TODAY()), MONTH(TODAY()), 15), DATE(YEAR(TODAY()),MONTH(TODAY()),30))
Whoa! Thanks for the response. Many Thanks! :)
Btw, do you have any eBook I can buy?
All I have is the articles published here on ablebits. But thanks for the idea :)
I want to add the value of certain cells only if the value = 1.
I have a list of guests to attend an event; I conditioned the cells so if they are attending and I type a 1 the cell goes green, 2= RSVP TBD and cell goes yello and 3= not attending and cell goes red.
I want to know the TOTAL number of guests attending (I will have to add all the cells if the value = 1)
I tried:
=IF(C3:C18=1, SUM(C3:C18)) but that returns the addition of all the numbers in that range of cells, regardless if they are 1, 2 or 3)
THANKS!
Hi Manolo,
All you need is a simple SUMIF formula like this:
=SUMIF(C3:C18, 1)
For more info, please check out our Excel SUMIF tutorial.
Hi Svetlana
Im trying to make a dynamic sheet for car configurations according to track and weather conditions, not sure if possible specially if they are around 30 tracks or is limited to X number of tracks. The idea is like this
A1= Track01, Track02, Track03, Track04, etc......
B1= Dry, Wet
C1= IF((A1="Track01" and B1="Dry";1;3)(A1="Track02" and B1="Dry";2;4)(A1="Track03" and B1="Dry";3;9)(A1="Track04" and B1="Dry";4;12)) etc.....
Thanks in advanced :)
Hi Ernesto,
You can express all of your conditions using nested IF's and AND. For example:
=IF(AND(A1="Track01", B1="Dry"); 1; IF(AND(A1="Track01", B1="Wet"); 3; IF(AND(A1="Track02", B1="Dry"); 2; "")))
Works at perfection, thanks :)
i want to make a mark sheet with result of different students, i want result fail if value=<34, then what will be the arguement, how can i write the cell range in formula. i have done it, but it is wrong! plz help
hi svetlana
i am working as a planning officer in textile. i have to make/maintain multiple sheet. can you help me?
imran
Hi..I am currently working on sales report and using IF formula. However I encountered IF error message - "IF only takes 3 arguments but this is argument number 4". Appreciate your help on this....thank you
Hi Alynda,
Yes, the syntax of the IF function allows for 3 arguments only. You can find the detailed explanation of each argument at the beginning of this article. If you provide more details about your formula, we will try to get it right.
Using the data in C16:C18, generate in Cell E16 the formulation that will check Cell C16 for a Y, an N or any other character and if this cell contains a Y the formulation will round the figure in Cell C18 (19.2589) to the number of decimals indicated in Cell C17 (3), if Cell C16 contains an N the formulation will not round the figure in Cell C18 and simply return the number that is in Cell C18 and if Cell C16 contains any other character, the formulation will return the error message “Invalid Character”.
Would this be an IF function?
if value entered B 1 40 to 45 the value C 2 36 and if enter 46 to 50 , the value C 2 37
Here is the formula for C2:
=IF(AND(B1>=40, B1<=45), 36, IF(AND(B1>=46, B1<=50), 37, ""))
A B
10 0
Please help, B=A"Paid", B=0"Outstanding" and 0<B<A"Pending" Thank you!
Hi Kea,
Here you go:
=IF(B1=A1,"paid", IF(B1=0,"Outstanding", IF(AND(B1>0, B1<A1),"Pending", "")))
Hi Svetlana, I working well thank you again for your help and sorry for late checking
Hello,
I have the following formula so far:
=IF(A1>=40,"40",""), If the value is less than 40 I need the result to be the exact value in the cell.
For example if A1= 39.5 I need the result to be 39.5 not blank as I currently have it in the formula. What can I replace "" with to get this result?
Thank you!
Hi Olga,
Just replace "" with the cell reference, like this:
=IF(A1>=40, 40, A1)
Dear Svetlana Cheusheva
Is this formula correct
=IF(H2="#N/A", "No", "Yes")
where #N/A is a result of vlookup which is applied in H2
Please help i am stuck here
Hi Khan,
You have to use the ISNA function to check another cell for N/A error, like this:
=IF(ISNA(H2), "No", "Yes")
Really v thankful to you it worked
Thanks Svetlana, I was using ISNA but wrong, this helped.
Hi can you help me formulate one formula for these situations:
1. If the actual completion date (F9) is less than or equal to the target completion date (E9) then it's ON TIME
2. If the actual completion date (F9) is greater than the target completion date (E9) then it's OVERDUE
3. If the target completion date (E9) is greater than the date today (B5) and the actual completion date (F9) is unfilled it's NOT YET DUE
4. If the target completion date (E9) is less than or equal the date today (B5)and the actual completion date is unfilled it's UNDONE
My formula I have right now is:
"IF(F9E9,"OVERDUE",IF(E9>B5,F9="","NOT YET DUE",IF(E9<B5,F9="","UNDONE"))))
But it says I'VE ENTERED SO MANY ARGUMENTS
Thanks!
Hi Tetay,
You have to use the AND function when entering more than 1 condition, like this:
=IF(F9<=E9, "ON TIME", IF(F9>E9, "OVERDUE", IF(AND(E9>B5,F9=""),"NOT YET DUE", IF(AND(E9<=B5,F9=""), "UNDONE", ""))))
Thanks but it does not work for the NOT YET DUE and UNDONE. I think there is something missing?
Because it still displays ON TIME even if the actual completion date (F9) is unfilled.
Oops... I forgot to check if F9 is not empty in "ON TIME" and "OVERDUE" logical tests.
Please try this one:
=IF(AND(F9<=E9, F9<>""), "ON TIME", IF(AND(F9>E9, F9<>""), "OVERDUE", IF(AND(E9>B5,F9=""),"NOT YET DUE", IF(AND(E9<=B5,F9=""), "UNDONE", ""))))
OMG Svetlana! Thank you so much, it's working. YOU'RE AWESOME
Please help me providing with encoding stating Week 1 Week 2 Week 3 Week 4 so on for the Year, to come automatically depending on Date in other cell.