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 121. Total comments: 4830
I need H5 to be multiplied by 6% if > A1 and multiplied by 7% if > than A2 and multiplied by 8% if > A3.
Hi Kristal,
Here you go:
=IF($H5>$A$1, $H5*6%, IF($H5>$A$2, $H5*7%, IF($H5>$A$3, $H5*8%, "")))
thanks! - sent you the info via email
The problem was with percentages entered as text strings. Emailed you back the fixed sheet.
Thanks so much for the help! appreciated!
Now i have a question around "if i can't get the text to percentage on the sheet to work unless i double click the box and click on the accept icon" (tick box image).
Is there a way to change format quicker on the sheet.
I've tried selecting the column, going to number format and changing to percentage - but then i still have to click in each box to accept it, before the formula works. Trying to see if i can save myself time and do it with a shortcut.
Thanks
In the worksheet you sent to us, I fixed the percentages in the following way:
- Select column H (the Percentage column), press Ctrl+H and replace % with nothing (leave the "Replace with" box empty and click the Replace all button).
- In some empty column in row 2, enter the formula =H2/100, copy the formula down to other cells, copy the column with the formula, then select column H, right click and select Paste Special > Values. The result would be decimal numbers like 0.75.
- Apply the Percentage format to column H.
Done!
It was and great thank you - it fixed it perfectly!!
Hi Svetlana
Thanks but unfortunately that doesn't work either, tried it and even if i have a 10% on the probability - it still brings up the number.
Hmm... this is very strange. The formula works just fine for me. If you can send us a sample workbook, and we will try to figure this thing out.
Hi
I'm trying to get a formula to work this is the detail:
Column G = sales
Column H = probability
Column J = status
I'd like to get a formula to work if its status is open and is above 75% then it returns the sales number - i have this but it won't work
=IF(AND(J300="Open",H300 >75),G300,"")
Hi Ash,
Your formula is correct except that you omitted the percentage :)
=IF(AND(J300="Open",H300>75%),G300,"")
If you'd rather not use the percentage char in formulas, then it should read H3>0.75.
So I entered the formula to have a cell name itself the workbook name which is a date. The other cell that I have turns into the day of the date. But since I have done = it only reflects the date not the day.
Hi Justin,
Sorry, I am not sure I can follow you. If the problem is just with displaying the date rather than the day of the week, select the cell, press Ctrl+1 to open the Format Cells dialog and select the desired date format there.You can find the detailed steps and lots of examples in our Excel Dates tutorial:
https://www.ablebits.com/office-addins-blog/change-date-format-excel/#custom-date-format
If you have a different issue, please clarify.
If we have two different worksheets.For example Workbook1 contains weights 0.5,1,2,3 and other worksheek contains the master that means that fine contains 0.5 value 10.00,1 value 20.00,2 value 30.00 and 3 value 40.00.
And i want to use formula to upload the same figure in Work sheet 1 also as a value that means if the weight is 0.5 that value should be 10 like that how to make formula
HI there,
can you help me with this project?
IF (A2 >26, A242, A263, A284,A2<104),4 "")
I appreciate your kind help
(A2 >26, A2>41, A2>42, A2>62,A284,A2<104),4 "")
Hi Fahad,
Sorry, I cannot understand the conditions. Can you elaborate please?
Helooo,
how can utilize this formula in my office reminders.
I have certain daily task that is fixed in every month. let me know how can I create reminders, that today I have particular task to perform?
A1= Level 33
B1>50%=YES and B150%=YES and C1<50%=NO
I am not sure I fully understand the logic. Nevertheless, here's the formula as per your conditions:
=IF(B1>50%, "YES", IF(C1<50%, "NO", ""))
hi there,
Searching for help,
I wanted my data to produce end result YES or NO:
must meet condition as below:
A1= Level 33
B1>50% = YES and B150% = YES and C1<50%= NO
please help , thanks!
I need help with finding the sum of the following:
If there is text in C10 and C11, I need there to be a value of 1 for each to calculate in F4, otherwise = 0.
Hi Elaine,
I can suggest the following formula:
=IF(AND(C10<>"",C11<>""),2,IF(OR(C10<>"",C11<>""),1,0))
The formula returns 2 if both C10 and C11 have values in them, returns 1 if one of the cells has a value, and if both cells are blank, 0 is returned.
If you are looking for something different, please clarify.
Column E has a product Names (X and Y) with the corresponding Value ($ amt) in Column G, If the product name is X I want a formula to return the value as (X*70/100) or Else Blank. The result is expected in column H. Please Assist.
Hi!
Try this one:
=IF($E2="X", $G2*70/100, "")
i would like excel classes
Need help,
I've a data in d2:d in which sometime there might be empty also(blank).So with reference to these I want information of a2:a but if d2:d have data I didn't want information of a2:a, I only want a2 information if d2 is blank other wise next skip a3 if its same then a4 and so on?
Please help me in this regard.
Hi Insu,
I am not sure I can follow you. So, let me check if we are on the same page. You want the formula to return a value from A2 if D2 is blank, right? If so, then you can use the following formula:
=IF(D2="", A2, "")
If you want to pull a value from D2 if it's not empty, then use:
=IF(D2="", A2, D2)
Thank you
I'm working on a spreadsheet that will have a $ amount in column C, one of a possible 4 employees names in column D, a cumulative running total in E, and then,at the bottom of the whole thing, a running total for each individual employees sales. I know basic formulas, addition, multiplication, etc., but I do not know how to do an IF formula such as this. Can anyone help? Thanks!!
I want to calculate if A1>=1.5, but <=2 then yes
Hi Tshepo,
Here you go:
=IF(AND(A1>=1.5, A1<=2), "yes", "")
Hi, Svetlana
Below condition is not working
=IF(OR(A1=c1,B1*F1),IF(A1=C2,B2*F2),IF(A1=C3,B3*F3))
Can you please correct me.
Column A Column B Column C Column F
B81234 16 B91456 $8,995.00
B81345 19 B81234 $4,887.50
B91456 27 B81345 $5,391.00
Regards
Manish
Hi Manish,
Try to put it this way:
=IF(A1=C1, B1*F1, IF(A1=C2, B2*F2, IF(A1=C3, B3*F3, "")))
Perfect it worked.
=COUNTIF(M95:M106,"Darryl*")
Hi Svetlana, I am using the formula below look for a specific that could be listed in the cell range listed below, such as the name Darryl that name could be clustered in with multiple names in one cell, But I need to count the name as one. I hope that makes sense
=COUNTIF(M95:M106,"Darryl", "Darryl Sally George")
Darryl, how did you get a response for svetlana so qwick? I have tried since last week.
Maybe you can help.
Hi, Svetlana.
I have in mind a (maybe an IF) formula I want implement.
In a cell I have a date of 6-17-15, in one cell (oh,say E7) when we started tracking an item as "Open". Cell F7 (7/7/15) would be the date we closed it. Cell G7 would tally the days it was open. If we closed it on 7/7/2015, the duration open would be 20 days and the formula would be simply be =F7-E7. Correct?
But, let's say we had not (closed it) filled in the Cell F7 yet and it is blank to visually show it as outstanding. How would I express the formula in Cell G7 to keep a tally of the open days. Then when we fill in the (or closed it) cell G7, it will correctly fill in the open days?
Hi!
I am sorry for overlooking your question. The notification never reached my inbox :(
If my understanding of the task is correct, you need a formula that subtracts E7 from F7 if both cells have dates in them, and if there is no date in F7, then E7 is subtracted from today's date. If so, the formula is as follows:
=IF(F7="", TODAY()-E7, F7-E7)
Please correct me if I am missing something.
It works great. Thank you.
Darryl,
The COUNTIF syntax allows for only one criteria. To count partial matches, you can use a wildcard char, like this:
=COUNTIF(M95:M106,"Darryl*")
Or =COUNTIF(M95:M106,"*Darryl*") if the name "Darryl" may be preceded and/or followed by other characters, e.g. "Mr. Darryl George".
Hi Svetlana, you are the best that did work..
I am try to count how many "Y"'s in a range of columns and convert that into a numeric value and place that value in a different cell.
Please help
=IF(SUM(D95:D106)="Y", "1")
Hi Darryl,
SUM can handle numeric values only, while the COUNTIF function works for text strings as well:
=COUNTIF(D95:D106, "y")
You can find more information in the following tutorial:
COUNTIF in Excel - count if not blank, greater than, duplicate or unique
Using Logical "IF" formula to determine if date in one cell is < date in another cell =IF(A1<B1,True,False). Returns the correct answer, however when I try to copy it to multiple rows....it does not! If however I go to each row and click the Insert Function menu option...it will change the answer to the correct one! Can't seem to figure it out! Please help
Hi Scarlet,
Usually copying a formula by selecting the cell and dragging down the fill handle works without a hitch. Are you coping it to other cells in the same column, or somewhere else? For example, the formula is in C1 and you need to have it in, say, C1:C100?
I am trying to add all of the values in column E that have the corresponding number 53017 in column G. I tried this formula but it didn't work.
=IF(G1:G53=53017,SUM(E2:E58))
Can anyone advise?
Thanks!
Hi Lisa,
You can use the formula similar to this:
=SUMIF(G1:G53, 53017, E1:E53)
I need help on an Excel formula. I have A group of cells containing text. The text in the range is either "In Process" or "Completed". If any of the cells in the range have text "In Process" the lead cell should return "In Process", if not, it should return "Completed". Please assist.
Hi, how do I get the value if true to be another formula? I have a list of customers (column A), and a list of corresponding dates (column B), I want to set the value if true to be, If cell A1 = Customer x, out put to be date (b1) + 2 days.
By having the formula as =IF(A1=Customer,"B1+2","") the output is B1+2 whereas I want it to display the date in B1 + 2 days?
Thansk
Hi Chris,
Just remove the quotes enclosing B1+2 because they turn any expression into a text string, and apply the Date format to the cell containing the formula:
=IF(A1="customer",B1+2,"")
In Cell L92 I am try to tally Cells F8, F12, F16, F20 if they say Yes. How do I do this?
Svetlana, why you ignore email from my question?
Can you please help me with following formula
i have a calculation in Cell A and another calculation in Cell B
in another cell i want to determine results as following
if value in cell A and Cell B are greater than or equal to .5 give me true otherwise false
if values in cell B is blank take value from cell A only and provide results
Hi Kamran,
You can use a formula similar to this:
=IF(AND(A1>0.5, B1>0.5), TRUE, IF(AND(A1>=0.5, B1=""), TRUE, FALSE))
Hi Svetlana
I am looking out for a formula to calculate an incentive structure
If My CTC is 10000 , and i have given a profit of 45000 , I want an formula to calculate the following slabs in incremental basis.
If employee achieved 3 times of ctc 5 % incentive
If employee achieved 3 to 4 times of ctc 10% incentive If employee achieved 4 to 5 times of ctc 15% incentive
5 to 6 times 20%
6 to 7 times 25%
Above 7 times 30 %
45000 split in 3 slabs
30000 = 30000 * 5 % Eligibility on 30000
30000 - 40000 = 10000 * 10 % Eligibility on 10000
40000 - 45000 = 5000 * 15 % Eligibility on 5000
Hi Svetlana,
I am referencing a date in cell L57 which is looking at a due date and my formulae works is written as:
=IF(L57>NOW(),"'OK'","OVERDUE")
My problem is if I enter a date in another cell,(Say L58)(that tells me that for example, a payment has been made) how can I add a multiple ÍF' function so that it that it references L58 also (which will have a date entry), and then correct cell L57 to read ÓK'' indicating visually that payment has been made.
Your help would be much appreciated.
Hi Jason,
You can embed an OR statement in your formula, e.g:
=IF(OR(L57>NOW(),L58>NOW()),"'OK'","OVERDUE")
Hi Svetlana
Thankyou so much for your response, however it still does not change the cell response to read OK (when a date value in cell L58 has been entered)
It is as if it does not overwrite the rule in the first statement.
Any ideas??
Jason,
It thought the formula should return OK when the date either in L57 or L58 is greater than the current date (i.e. greater than NOW()).
If you want it to return 'OK' when either a date in L57 is greater than NOW() or any date is entered in L58, then the formula should read as follows:
=IF(OR(L57>NOW(), ISNUMBER(L58)),"'OK'","OVERDUE")
Thankyou so much Svetlana, that worked!
I have in mind (maybe an IF) formula I want implement,
where I have a date of 6-17-15, in one cell (oh,say E7) when we started tracking it as "Open". Cell F7 (7/7/15) would be the date we closed it. Cell G7 would be the days it was open, If we closed it on 7/7/2015, the duration open would be 20 days and the formula would be simply =F7-E7. Correct?
But, let's say we had not filled in the Cell F7 yet and it is blank. How would I express the formula in Cell G7 to keep a tally of the open days, then when we fill in the G7 cell, it will fill in the open days?
I hope I explained it well.
Hi Svetlana! I'm trying to figure out an IF statement using dates. Something like, IF(B2=older than three years than NOW(),"Too old", "New"). So simple but I can't figure it out. Thank you!
Hi Michael,
You can use the DATEDIF function to calculate the difference between 2 dates in years. For example:
=IF(DATEDIF(B2, TODAY(), "y")>3, "too old", "new")
This worked perfectly! Thank you so much :D
I am trying to get this formula to reference one more cell. if the additional cell contains a date, the formulated cell will be blank.
any suggestions?
=IF(ISBLANK(Response_Due_Date),"",IF(Response_Due_Date<TODAY(),"PAST DUE",""))
Hi!
I think you can add an OR statement to the 1st logical test:
=IF(OR(ISBLANK(Response_Due_Date), ISNUMBER(additional_cell)), "", IF...
I'm trying to enter two IF functions in one cell for a toggle drop down. How do I connect the two formulas?
I'm getting #VALUE! with this
=IF($H$5="step-function",IF(I4<$D$3,$C$4,IF(I4<$E$3,$D$4,IF(I4<$F$3,$E$4,$F$4)))),IF($H$5="continuous",IF(I4=1,$C$4,IF(I4<$D$3,($D$4-$C$4)/($D$3-$C$3)+H6,IF(I4<$E$3,($E$4-$D$4)/($E$3-$D$3)+H6,IF(I4=$F$3,($F$4-$E$4)/($F$3-$E$3)+H6))))))
Hi Svetlana,
Need a little help. I have 4 text from which i have to choose, if 1st is present then others are false, if 1st missing and second is present then 2nd is true, if 1st and 2nd is missing and 3rd is present then 3rd is true and if 1st 2nd 3rd is missing then, if 4th is present then 4th value is true.
How do I use IF formula here so that I can get my desired result only from many?
Sorry for the confusion.
Right now I am using below formula but it seems to be working only with first column.
=IF(F6" ",F6,(OR(AND(G6=" ",OR(AND(G6" ",OR(AND(H6=" ",OR(AND(H6" ",OR(AND(I6=" ",OR(AND(I6" "))))))))))))))
Example is mentioned below for your reference
Column1 Column2 Column3 Column4 Result
A B -- D Sould be 'A' (A is first present text)
-- -- C -- Should be 'C' (C is first present text)
-- B -- D Sholud be 'B' (B is first present text)
-- -- -- D Should be 'D' (D is first present text)
-- B C -- Sholud be 'B' (B is first present text)
Took a little time but I have solved this problem.
Thanks so much for your help for creating this amazing blog though.
This formula is working for me: =VALUE(IF(E12="X","660",IF(E12="","0")))
but I need to make 2 additions:
E12="1","660"
E12="2","660"
When I've added them I get a #VALUE! entry in the cell. Can you please help me with the right formula? Thanks so much!
Hi Shannon,
I am not sure why you use the VALUE function in the formula. The following one works for me:
=IF(OR(E12="X", E12=1, E12=2), 660, IF(E12="", 0, ""))
Hi Svetlana,
How do i set the formula if i want to calculate the bonus based on 20% of their basic salary, and the salary is cap at maximum $6000. Meaning to say if someone basic salary is at $8000, still he will received the bonus at $6000x20%=$1200. And if someone basic salary is at $5000 then i would be $5000X20%=$1000. Your advice please. Thanks
Hi Low,
Supposing column A is salary, you can use a formula like this:
=IF(A2<6000, A2*20%, 6000*20%)
I have to use and “IF” formula to fill cells in a column at the end of a table. I have to formulate the new column so that if there is a 2-1 ratio from Field D data to field C data then field E data has a good result, otherwise it is a bad result. I have gotten this far, =IF(D2>C2, "Success","Failure") but cannot calculate the ratio. Seems simple, but I cannot figure out how to calculate that D2 needs to be twice the amount of C2, I can only figure it to be greater. I am new to Excel.
Area. TargetDate. Code. Aa. Aug 1 2015. 01. Ab. Aug 1 2015. 02. Aa. Aug 2 2015. 03. Ab. Aug 2 2015. 04. My question is what formula should i use to display automatically this value in the nxt table. . Aug 1 2015 Target. Area. Code. Aa. 01. Ab. 02. . Please help me! Thanks
Hai Svetlana,
Still waiting for your valuable reply for given below :
A is the date column, B Column is text which can be repeated in same column with another date, C column is another text which can also be repeated with column B,
Now I need formula if date is less than today and if text in column B and C matches then get cell data of day before yesterday with same text combination.
Pl. help
Brajesh,
Sorry, I cannot figure out a formula for this task.
Dear Svetlana,
I would like requesting help from you, I need in excel Coulmn A2 to A100 each coulmn having different numbers and I need to display in B2 column "More Line" if A2 to A100 coulmn's any numbers greater than 3.
Lines
1
1
1
1
1
2
2
2
3
3
Hi Abdul,
Try the following formula:
=IF(MAX(A2:A100)>3, "more line", "")
Hi Svetlana
A2, A3, A4 and A5 cells have the following info
Lost
Abandoned
Won
Open
What conditional formatting I must use so that if an OPPORTUNITY_STATE is "Won" than it turns the background green, "Lost" or "Abandoned" it turns red and "Open" it turns blue
Hi Joe,
Select the cells A2 to A5 and create 3 rules with the following formulas:
Green: =$A2="won"
Red: =OR($A2="lost, $A2="abandoned")
Blue: =$A2="open"
how to filter different font colors in excel column in old version..
please help me
Hi Svetlana, I was hoping to get help on the following:
If the Average of cells B2 through B14 is greater > then the Average of B9 through B14 , fill in the number of the Average of B2:B14. If not (if the other Average is a higher number) fill in that number in the cell.
This is how I am doing it and it is not working
=IF(AVERAGE(B2:B14)>AVERAGE(B9:B14),"=AVERAGE(B2:B14)","=AVERAGE(B9:B14)")
Thank you
Hi Valeria,
You were almost there :)
=IF(AVERAGE(B2:B14)>AVERAGE(B9:B14), AVERAGE(B2:B14), AVERAGE(B9:B14))
Hi All,
Just wondering if you can help me with below validation?
B7 text:I have a drop-down here with Yes or No selection (achieved with data validation)
B8 text: Here is my challenge. If in B7 Yes is selected I would like to mark B8 cell with grey color. If No selected in B7 I would like B8 to remain blank.
I tried Conditional formatting (=IF($C$7,"No") then no format set but doesn't working.
All helps, ideas, suggestions are appreciated.
Elizabeth
Hi Elizabeth,
IF is not needed in Excel conditional formatting rules because they are conditional per se.
Try creating 2 rules for B8 with the following formulas:
Grey: =$B$7="yes"
No format: =$B$7="no"
Hai Svetlana,
Thanks for help but I need something different as follows :
A is the date column, B Column is text which can be repeated in same column with another date, C column is another text which can also be repeated corresponding to column B,
Now I need formula if date is less than today and if text in column B and C matches then get cell data of day before yesterday with same text combination.
Pl. help
Hello,
I am trying the If statement as follows =IF(C2="delivered", "No", "Yes") but everytime excel returns with: the formula contains an error.
How can I fix this?
Nevermind solved it
Thank you anyway.
Hi Sander,
The formula is correct and works fine in my Excel. Probably you have the List Separator set to ";" in your Windows Regional settings. If so, try replacing commas with semicolons:
=IF(C2="delivered"; "No"; "Yes")
Yeah, but that was not the problem. It has something to do with the quote signs,these signs do not work "delivered" but if I do the this =""""" the formula correct itself and works fine.
Not really sure whats going on but it works.
Thank you for your help Svetlana
Sander,
This is very strange indeed... Though, sometimes "smart quotes" copied from a web-site may cause a problem and retyping straight quotes in the formula bar fixes it.
Hi,
I have an attendance chart for my employees. If they have an infraction, it adds a value like +1 or +.5 based on whether they were late or called in sick. If they work an extra day or overtime, it removes a value like -1 or -.5. I use the COUNTIF formula, but the problem I'm having is if they have more OT than call outs, when they call in sick again, it doesn't adjust the 0 balance to +1 (because there are more negative values in the SUM). Can I use the IF function to keep a running total, so that if their value is already at zero it will still add +1 despite there being more negative numbers in the SUM?
Example: Callout twice in a week (+2), work 3 extra days (-3, but the max is zero as you can't go negative). Call out (+1), the value is still zero, but it should be 1.
Hello Svetlana,
I am writing this formula in Cell E3 :
=IF(C4:C9="x",0,15)
if column c4 to c9 has an "x" or "X" in it it should show zero other wise the value 15. it is showing me #NAME?
I also tried running :IF(C4&C5&C6&C7&C8&C9="x",0,15). this works for the first cell C4 and the value on E3 changes to zero but as soon as i enter x in c5 or further it shows 15. where am i wrong?
thank you
Hi Asif,
Just add the AND statement in the logical test, like this:
=IF(AND(C4="x", C5="x", C6="X", C7="x", C8="x", C9="x"),0,15)
Svetlana,
what i was trying to accomplish was that if any of the cells contain "x" it would show a zero. i used your formula and switched the AND with OR and mission accomplished. thank you so much
hey
please need your help...
i want to calculate net absentees of an employee. condition is:
1- two days per month are allowed (no deduction is applicable)
2- if absentees exceed 2, then deduction is made.
3- want to calculate net absentees. where days absent is less than days allowed, the formula shall give ZERO answer.
4- days allowed cell # C10, days absent F10
Please help.. thanks
Hi Svetlana
Please help me to write a formula for the following requirement;
1) If number of days between cell A & cell B ≤ 50% of number of days between cell A & cell C and Cell E ≥ 60% of cell D then format cell F with "SAFE ZONE" with Green filled.
2) Else cell F with "CRITICAL" with Red colour filled.
Respond me asap. Thank you in advance.