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 85. Total comments: 4830
Hi, I have a problem with loop.
The idea is that i enter a number at A1
I want to know if the number
====================================
less than of equal to 100 13
101 to 500 7
501 to 1000 7
every 1 to 500 thereafter 6
====================================
For example, i enter 450, the result is 13.
550, the result is 13+7=20.
I just know one step. "IF(A1<=500,13)"
Please help.
====================================
less than of equal to 100 = 13
101 to 500 = 7
501 to 1000 = 7
every 1 to 500 thereafter = 6
====================================
Hi,
I have a problem where I have to write if function in Excel VBA as follows:
Module1 = Cells(j, 80).Value
Module2 = Cells(j, 81).Value
Module29 = Cells(j, 108).Value
Module30 = Cells(j, 109).Value
If Module1 = "A" Then
Cells(i, 9) = Module1
End If
If Module1 = "B" Then
Cells(i, 9) = "Good”
End If
If Module2 = "A" Then
Cells(i, 10) = Module1
End If
If Module2 = "B" Then
Cells(i, 10) = "Good”
End If
I have to input 30 times from Module1 to Module30.
I have changed Module1 to “Module” & k (k for next loop is added).
It does not work.
Module1 not equal to “Module” & k
Amended
For k = 1 To 30
If "Module" & k = "A" Then
Cells(i, k + 8) = "Module" & k
End If
If "Module" & k = "B" Then
Cells(i, k + 8) = "Good”
End If
Next
Can I use this method in “If” fuction? How to solve?
Many thanks.
hiii sir,
please find the following details, in credit column some amt is there that amt should be come automatically to particular column which i have mentioned,
please help me which formula i have to apply.
cr amt name bs kr sn
6123 DC
4450 BS
1871 SN
1871 SN
887 KR
6711 BS
I'm trying to get the cell to return a blank if it finds the referenced cell also blank:
=IF(F3"CodeList",LEN(D3),IF(F3="CodeList","0",IF(ISBLANK(F3),AZ3,BZ3)))
=IF(F3"CodeList",LEN(D3),IF(F3="CodeList","0",IF(ISBLANK(F3),"","")))
I tried it both ways, using known blank cells that will always be blank (AZ and BZ), and also using "". It performed the first two in the formula, but always returns a "0" if the cell is blank.
Also took off the [value_if_false] at the end of the formula to mirror what I was seeing in here, but didn't work either. Always getting a "0" when = CodeList or is blank.
HOW DO I FORMULATE IF THE "VALUE_IF_TRUE" IS A COMBINATION OF 2 WORDS FROM DIFFERENT CELLS.
=IF(C49="2",I47&" "&D8,IF(C49="1"," "," "))
THE I47&" "&D8 SHOULD BE WHAT IS WRITTEN IN CELL I47 AND CELL D8
if cell contain text how to count
How to write the formula to count the no of Sundays beet ween two dates (ex-30/06/2016 beet ween 15/07/2016)
Hi jayantha,
You can use the following formula:
=INT((WEEKDAY(A1-1)-A1+B1)/7)
Where A1 is the start date and B1 is the end date.
Hi,
I am interested to set a formula to process student's marks.
If (A1-B1)or (B1-A1)is less than 17, D1 is (A1+B1)/2
But If (A1-B1)or (B1-A1)is more than or equal to 17, D1 will be average of C1 and either A1 or B1 which is closer to C1.
Thanks in advance
i have question for you,
based on my excel sheet two column is there example document type and posting key column is one sheet if this column match in second sheet document type and posting key column i have to update the remain second sheet data to first sheet.
please help on this query!!!
regards,
siddesh
Hello, Sanket,
Please try the following formula:
=IF(B4>DATEVALUE("11/14/2015"),"15%", IF(B4>DATEVALUE("05/31/2015"), "14.5%", "14%"))
Hi I Wanted to Set Excel Formula For The Three Condition Like
1.If The Date Fall Before 31.05.2015 The Rate Of Service Tax Will Be 14%
2.If The Date Fall Before 14.11.2015 The Rate Of Service Tax Will Be 14.5%
3.If The Date Fall After 14.11.2015 The Rate Of Service Tax Will Be 15% What Would Be The Formula For That Said Question
r u get answer?
I am trying to use an "if" function that looks at the closing value of the loan principal column (D)... if the value is negative (loan is paid off), the function will populate the specific month the loan value turns negative (the qrtly payment dates are contained in column A), into a cell at the top of the page. Is this possible?
Hi,
Is there a way to display a value based on information across 2 cells. So for example I have 2 products with data detailing the month purchased so want the output to detail the product purchased or both. So the example below the value would come back under product bought for Cust 1 "Both", Cust 2 and 3 "Product 1" and Cust 4 "Product 2"
Cust number Product bought Product 1 Product 2
1 February April
2 March None
3 January None
4 None August
Thanks,
Lee
Hello, Lee,
Please try the following formula: =IF(AND(ISBLANK(C2),ISBLANK(D2)),"None",IF(AND(ISBLANK(C2),NOT(ISBLANK(D2))),"Product 2",IF(AND(NOT(ISBLANK(D2)),ISBLANK(D2)),"Product 1","Both")))
Hi
I just want the if formula to return the same value that is in a particular cell, or make a caculation.
it reads like this right now =IF(F3=" ",C3,((C3+F3)/2)).
In case cell F3 is empty, i want to display the same value that is in cell c3. However, if f3 is not empty, I want to calculate the average)...
right now it is just returning to me the result of average calculation ((C3+F3)/2) even if the f3 is empty...
Can you help ?
Hello Rob!
In your formula, there is a space between the quotation marks =IF(F3=" ",...).
Remove it and the formula will work fine: =IF(F3="",C3,((C3+F3)/2))
Awesome !!!
Thank you !
How can I submit some more questions, but using the actual file/spreadsheet ?
I have some Pivot Table related questions and i think it's hard to explain...
Thank you Andrei for your help !
Hello Svetlana,
I have a seemingly simple formula, not sure why it doesn't work on me!
=IF(ISNUMBER(SEARCH(OR("May-16",AX3),OR("Apr-16",AX3),OR("Mar-16",AX3))),1,0)
I need a 0 or a 1 if the value in AX3 equals Mat-16, Apr-16 or Mar-16.
This doesn't work either =IF(OR(AX3="Mar-16",AX3="Apr-16", AX3="May-16"),1,0)
Please help!
Many thanks in advance
Hello Anon!
You cannot compare a date with the text string "Apr-16".
Use the following formula instead: =IF(AND(YEAR(AX3)=2016,OR(MONTH(AX3)=3,MONTH(AX3)=4,MONTH(AX3)=5,)), 1, 0)
if i type A1 in cell B1 then i want the values in A1 in C1, please ans
Hello Ajay,
You can enter the following formula in C1:
=INDIRECT(B1)
I want the cell to increase by $1.00 for every 6 pieces. So if I have 13 pieces it should be $3. I created this formula but it's not correct, please help.
=IF(B32<=6,"$1.00") OR(B32,7==13,"$2.00""∞")
Hello!
Can you help me to create this formula:
1 to 4 = LOW
5 to 9 = MEDIUM
10 to 14 = HIGH
Thanks in advance :)
Hello Roy!
You can use this formula: =IF(AND(A1>0,A1<=4),"LOV",IF(AND(A1<=9, A1>4), "MEDIUM", IF(AND(A1<=14, A1>9),"HIGH", "out of range")))
If a value in cell A is false and the value in cell B is within the range in cell C and D (assuming cell C if 99.0% and cell D is 100%), enter the value in cell E. Please help me in creating f formula for that. Thanks
Hi! Can you please help me with this?
For example: I want a cell to display "done" if material down and machine down was met and if not, it will display "attention".
=IF((AND(Z3="Material Down","Machine Down")),"Done","ATTENTION")
Hello Dev Reyes!
In the AND statement, you forgot to specify the cell that should contain "Machine Down". For example:
AND(Z3="Material Down",Y3="Machine Down")
And the whole formula would be:
=IF((AND(Z3="Material Down",Y3="Machine Down")),"Done","ATTENTION")
hello,ma'am I have Excel sheet of Indian population and I have to classified accordingly by Tier -1 to Tier -4 so how can I put condition in this sheet.
Tier-1 =10000000 population
so on till tier -4
Thank you.
Give me a formula for making a result sheet in which i want the result
there is four NOS(Subject)
if student's marks in all NOS is 0 Then Absent.
if student's marks >=70 in all NOS Then Pass.
if student Passs a NOS and fail in rest of the three NOS Then NOS PASS.
if student's marks in all NOS is <70 Then Fail
Hi, i cannot seem to get this formula down.
Use an IF function in cell J18 to calculate the commission earned for beverages for order 1. The beverage commission is 10% of the total sale if the customer buys a beverage. If the beverage sale amount (cell D18) is greater than 0 the beverage commission equals the sales total (cell G18) multiplied by the beverage commission rate (cell G12). Otherwise the beverage commission is 0. Use appropriate relative and absolute cell references.
I am trying to create a formula that if text = (specific text) then add 1, and the total number of (specific text) fields there are in that column.
I have a specific ticket type for an event in column F in this spreadsheet, and I am trying to create a formula at the bottom that will tell how many of each ticket type there is.
Hello Jeanette!
To count the number of cells with a "specific text" you can use the COUNTIF function. For example:
=COUNTIF(B1:B8,"specific text")
Hi Guys,
Please help on the following:-
Gross profit margin>=20% = 0.7%
Gross profit margin>=25% = 1%
Gross profit margin>=30% = 1.5%
Gross profit margin>=35% = 2.0%
Gross profit margin>=40% = 2.5%
Hello Theng!
You can enter the following formula: =IF(F1>=40,2.5,IF(F1>=35, 2, IF(F1>=30, 1.5, IF(F1>=25, 1, IF(F1>= 20, 0.7, 0)))))
F1 contains Gross profit margin.
I have a spread sheet that as A as the Roster, B as the Go or No Go, C as a number value between 1-40, and D as 4 classifications.
1-23=Unqual (NOGO)
24-29=Mark(GO)
30-35=SS (GO)
36-37=Ex(GO)
I want to make a formula that when i type in the number value in C, it will automatically fill in B and D with the info i need based on the table above all the way down the rows.
Hello, thanks for your time.
I'm building a spreadsheet in which I have a list of names, and need these names to represent a value. For instance, if cell AL5 states "COL", "TOR", or "BAL", it should be assigned a value of two, but if cell AL5 states "TEX", "BOS", "NYY", or "ARI", it should be assigned a value of 1. Please help put together a formula to do this; I've got the first part at =(IF((OR(AL5="TOR", AL5="BAL", AL5="COL")), "2"))
I have a spreadsheet in which I the if has 2 requirements to be correct, and if so then it will be this number, but if its below it needs to equal zero, and if it is above it equals a fixed number. How do I get it to have 2 options if false?
=IF(AND(F1>29999,F1<70001),(F1-30000)*0.02,40000*0.02)
the 40000*0.02 is if its greater than 70001 but if it is less than 29999 then it needs to be 0
any help?
Hello Chase!
You can use two nested IFs:
=IF(F1>29999,IF(F1<70001,(F1-30000)*0.02,40000*0.02),0)
Hey All
I would appreciate any guidance on the following formula please:
If column A =1 and column B = 2 return X otherwise return Y.
Many thanks
Alice
=If(A1=1,If(B1=2,"X","y"),"y")
Hello everybody!
That seems so simple but I can't do it :(
I would like to know the formula for this:
If any text is found in cells T23 U23 V23 or Z23 this same text should be copied to this cell where the formula goes (C23).
This text could be any of these four: Apple/Pears/Peaches/Grapes
Thank you so much
Hi Augusta,
What if 2 or more cells (T23, U23, V23, Z23) contain different texts? Which one should be copied to cell C23?
Hi Guys
I have this project wherein I want to check the ROWS and look for Installed or Blank and will input C or Complete on Column A, If it sees 1 just do nothing
A B C D
1 Installed Installed
2 1 1 1
3 Installed
Hi sanjay...
In this way, using the formula...
=VLOOKUP(C55,Sheet1!A:E,5,FALSE)
=IF(O14>"80""A",O14>"60""B",O14>"40""C")
I want to know how to check whether a value is repeated in a column.
e.g:
123
231
132
123.
for a column that is as large as A3:A500.
Thanks
I want to find out that if someone given a date and time, I should get a response block or empty. For the same I applied If and Datevalue formula but it is working only when I mentioned the excel column address, not on the range. Can you please: IF(AND(W4:W300=DATEVALUE("07/16/2016"),X4:X300=1),"BOOK","EMPTY")
Please suggest...
in if condition calculate the "n" number of times
For a Hotel Maintenance Log. I have a column for recording room numbers and want to apply a condition to a certain room number, so that front desk staff know what to do differently for this one apartment. I tried:
=IF(A2=1307, "call owner")
but no luck. Grateful for any ideas - thanks
No worries - I have solved it:
=IF(A2=1307,"CALL OWNER","")
This leaves the cell blank if it's not for 1307, so works perfectly.
Hi
I have a nested IF AND formula that looks at times [HH]:MM It works fine until I have time over 24hours. I have this section in my formula:
IF(AND(N2>=TIME(24,0,1),N2<=TIME(48,00,00)),"Between 24-48hrs")
It doesn't work though...any ideas??
Not to worry..I have solved it by converting time to decimals and working the > or < off those figures rather than time!
Criteria Cell1 and Cell2 having numbers which may be higher,lower or same.
What will be the formula to get in Cell3 as reply "Higher", "Lower" or "Same" any 1 will be answer.
=IF(AND(A1=A2),"SAME", IF(A1<A2,"LOWER","HIGHER"))
I have a score range to grade students A,(85-100) B, (75-84) C, (65-74) D, (50-64) & E (0-49).
How would I enter the values using the IF function so that when I drag down using the handle it automatically give grading. Please help.
Thanks.
I have two sheets,
1st sheet "A" column contains order no. in sequence and and "E" column contains Name of customer
in 2nd sheet if I put any order No. in "C" column "D" column should show respective customer name of particular order No. from sheet 1.
For eg.
in sheet 1
A22=2200 E22=Dettol Incorporation
if I put 2200 in sheet 2 in c55 than D55 should show as E22 in sheet 1 ie. Dettol Incorporation
Thanks
Dear Svetlana
i will put order no.in sheet 2 in sheet 2 in c column
than in d column should show company name of respective order No. from sheet 1
please help
thanks
got it, i found solution,
=VLOOKUP(C55,Sheet1!A1:E500,5,"FALSE")
thanks
In cell E8 I have write =IF(G8="W",0,1)+IF(G8="WF",0,1)+IF(G8="I",0,1) to got 0 in E8 when I write in G8 W WF or I otherwise 1. But I get 2 in cell E8 When I write W WF or I. Tell me the mistake why it comes 2 instead of 1?
Champs need ur help i am rookie with excel and cant fig out the following formulae to apply
Cell A2 = if Cell A1 is less than Cell B1 then Value should be cell A1 Minus cell B1 else if cell A1 is greater than cell B2 then value should be A1 Minus B2 ,,, and if the value of A1 is between B1 and B2 then should just say "ok"
Example A2 = where the answer will be
A1 = 3.3 B1 =2 B2 =3 this case A2 should give an answer as 0.3 and the cell should go red or any other colour,, please somebody help out
Dear Svetlana Cheusheva please reply waiting for the same, If you are busy it's okay take your time.
and if cant be done please drop a message it cant be done so that i can drop this file of mine
Have a good day
Hello Manish,
Assuming that the value in B2 is always greater than in B1, you can use this formula:
=IF(AND(A1>=B1,A1<=B2),"OK", IF(A1<B1,A1-B1, IF(A1>B2,A1-B2,"")))
To highlight A2 with color, select it and create a conditional formatting rule with this formula =ISNUMBER(A2)
Here are the detailed steps to create formula-based conditional formatting rules.
Dear Svetlana ,
Thank you it works awesome ,,but i dont get a negative answer as in the answer is right but without a negative sign
Example A2 = where the answer will be
A1 = -3.3 B1 =2 B2 =3 this case A2 should give an answer as ( -0.3)
Rest all is fine thank you for the help your ( Excel-lency)
Dear Manish,
In your original post, the first condition to check was as follows:
"if Cell A1 is less than Cell B1 then Value should be cell A1 Minus cell B1".
And it is exactly what the formula does: A1 (-3.3) is less than B1 (2), so the formula returns -5.3 (-3.3-2)
If you expect a different result, then please list all of the conditions in the order they should be checked in the formula. (Nested IF's check conditions in the order they appear in a formula; if the first condition is met, other conditions are not checked).
Please i have numbers from 1 to 10 representing several texts in a collumn. i need a logic that can help me sort the out once without writing the logic one cell to another.
Hello,
I am currently updating my company's Excel files. I wanted to add the day's date in a cell if a project is marked completed. ive' used the following formula: =IF(ISTEXT(U:U), NOW(), ("")). it worked but I am facing a problem. the projects that were marked completed had the date in the cells next to them but the dates keep changing everyday. can you please help me with telling me the right formula to add an unchanging date using IF function?
Thank you,
Maan
Reply
Hi, Kindly help me how to settle this ;
cell A1 is 55, and eveyday change its value
cell B1 is the Day
cell C1 is to copy the A1 at that day.
now the next day B2, A1 is 70 , so how can I automatically change the C1 value to 70 ??
Thanks in Advanced
Hello,
Can you tell me, how cell can refer to a range with equal sign, in such a formula (which is working):
"If(B1=C1:C300;E1:E300;0)
Thank you in advance!
Hi, I need a formula for one cell:
IF A2 has a value between 101-122, then text "below average"
IF A2 has a value between 123-144, then text "average"
IF A2 has a value between 145-200, then text "above average"
IF A2 has a value between 201-250, then text "not acceptable"
Thank you.
Hi Maria,
You can use this formula:
=IF(A2>200,"not acceptable", IF(A2>144,"above average", IF(A2>122,"average", IF(A2>100,"below average",""))))
ok I am trying to create a score chart. Where the same cell returns a different value based on what is in that cell. if someone keys a 0 it returns a 5, if a 1 or 2 it returns a 4, if a 3 or 4 it returns a 3. something along the lines of
=if(Q5=0,5),if(Q5=1,4),if(Q5=2,4)...
thank you
oh I got it...
=IF(Q38=0,5,IF(Q38=1,4,IF(Q38=2,4,IF(Q38=3,3,IF(Q38=4,3,IF(Q38=5,2,IF(Q38=6,2,IF(Q38>=7,1,""))))))))
Hi,
I wanted use the formula with more than one logical test. what should I do. how to do so.
Let's say. If,a1="Thursday","OFF","Working:)
Apart from Thursday I also wanted to use Friday. What can I use to do so.
Hi Tanveer,
If you want to display "OFF" for Thursday and Friday, you can use the following formula:
=IF(OR(A1="Thursday",A1="Friday"), "OFF", "Working")
If you are looking for something different, please clarify.
How to pay you thanks,
you were awesome.
Yes that is what I meant and it is working.
Thank you very much for your help.
Have a good one.