For powerful data analysis, you may often need to build an Excel IF statement with multiple conditions or use IF together with other functions. This tutorial will show you the most effective ways to do this. Continue reading
by Svetlana Cheusheva, updated on
For powerful data analysis, you may often need to build an Excel IF statement with multiple conditions or use IF together with other functions. This tutorial will show you the most effective ways to do this. Continue reading
Comments page 115. Total comments: 4573
Thanks, these examples are very helpful
$125/100 people or part thereof
I used the following formula:
=B19*IF(B4>100,IF(B4>200,IF(B4>300,IF(B4>400,IF(B4>500,6,5),4),3),2),1)
Is there is a better method or function that could be used?
Also for, requires 1 person per 50 tickets sold, minimum of 5 security personnel at an event. Evening events are charged a flat rate of $200/security person.
I used,
=B21*IF(B4>250,IF(B4>300,IF(B4>350,IF(B4>400,IF(B4>450,IF(B4>500,11,10),9),8),7),6),5)
F347874 is 30-Jun-14
why this formula is showing false
IF(AND(F347874>"03-31-2014",F347874<="09-30-2014")
Please help
All data is in descriptive form .
I tried one formula for counting no entries but it won't work.
=count(if(C1=Sheet1C2),C2:C60)
I need an IF formula to reflect this information:
If cell A1 equals:
Weighted % Points
20%+=3
10.1-20%=2
5.1-10%=1
0-5%=0
IF(A1<5%,0,IF(A1<=10%,1,IF(A1<=20%,2,3)))
I think I have a simple request but have been unable to figure this out.
Cell A1 is used for a price to be input.
Cell B1 needs to output a fee based on the price input into cell A1
The parameters would be as follows:
In A1 $1999 and below should equal $125 in B1
In A1 $2000-$4999 should equal $225 in B1
$4999 and greater should equal A1*.05
Ive tried IF, AND, & OR functions and I can't get it. Please help.
Hi Terrence,
You can use the following nested IF's:
=IF(A1>4999, A1*0.05, IF(A1>1999, 225, 125))
Thanks!
Hi,
I'm a little stuck and I'm hoping I'm trying to use the right formula!
I'm making a document to manage when our contractors are working and our margin.
I need a formula that will work out our margin based on if they are getting paid daily or hourly, thus is cell C35 says Daily I need it to multiply D35 (The margin) by 5, and if it says Hourly it needs to multiply D35 by 37.5.
Thanks in advanced!
Abbie
HI
I'm trying to have an one cell answer (A1) that takes IF from multiple columns. If B1 is 1 then write "Apple", if it's empty, don't write anything. If C1 is 1 then write "Banana", (if empty don't write anything). If D1 is 1 then give "Orange"....
If say B1 and C1 have "1" then the cell should give Apple, Banana.
Many thanks in advance
Diana
Hello,
I'm trying to create a series of columns, the number of which rely upon a set period of time entered by the user (Each represents a week). The date for one column relies on the date of the previous:
=IF(PREVIOUS COLUMN+7 <= END DATE, PREVIOUS COLUMN+7,"")
However this condition causes #VALUE! errors after the last column, so I tried to use the IFERROR function:
=IFERROR(IF(PREVIOUS COLUMN+7 <= END DATE, PREVIOUS COLUMN+7,""),""
as a part of conditional formatting to hide the #VALUE!, but the #VALUE! still keeps popping up. Any advice?
Hi Svetlana,
Can you use 3 rules in a formula?
IF(AND(F20<=99,G14<=29999,J187"28-34 Degree Pitch")"$65.00"
How can I make this formula working, using 3 scenarios.
Really hoping you can assist Svetlana,
I am stuck! I have tried all the formulas I could find on conditional formatting to try to get the following result:
If C2<10 and W2=0 Fill background Red
Hope someone can help:)
Heather,
Go to the cell C2 or W2 you want the the conditional formatting to occur.
Click on the Conditional Formatting Icon and select Manage Rule. You will see a pop-up window the Conditional Formatting Rule Manager.
Click New Rule.. and select "Use a formula to determine which cells to Format" on the Rule Type.
On the empty line "Format values where this formula is true:" enter the formula =c2<10 or click the box on the end of the line which will allow you to pick the cell C2.
Now select the "Format.." button and there are tabs "Number", "Font", "Border" and "Fill". Select the "Fill" tab and under the "Background Color: select the Red color and the Sample window should show red. Click "O.K" to finish up.
Once you type numbers on the cell the formatting should occur if the condition is true then the cell will highlight red.
Hope this helps.
Hi Svetlana,
I am trying to convert marks to grades and it worked using the below formula:
=IF(D2<50,"F",IF(D2<60,"P",IF(D2<70,"D",IF(D2<80,"C",IF(D2<90,"B",IF(D2) instead of (<) and keep the rest exactly the same.. except a trick with the IF he said!!... is there something like this? different function than the IF?? I am confused.
Thanks,
Bas
Hi Svetlana,
I am trying to convert marks to grades and it worked using the below formula:
=IF(E9<50,"F",IF(E9<60,"P",IF(E9<70,"D",IF(E9<80,"C",IF(E9<90,"B",IF(E9 (not <) and keep the rest exactly the same.. except a trick with the IF... is there something like this? different function than the IF?? I am confused.
Thanks,
Bas
Privet Svetlana, ty voobshe genie!
I need the formula for S9 to give me either "Dog", "Top Seller", "Workhorse" or "Challenge".
For eg.:
If P9 = "Low" and R9 = "Low" I need "Dog" in S9
If P9 = "High" and R9 = "High" I need "Top Seller" in S9
If P9 = "Low" and R9 = "High" I need "Workhorse" in S9
If P9 = "High" and R9 = "Low" I need "Challenge" in S9
I hope you can help on that..
Hi Ivan,
Don't think I am, but thanks anyway:)
This can be done by using nested IF's with embedded AND statements, like this:
=IF(AND(P9="low", R9="low"), "dog", IF(AND(P9="high", R9="high"), "top seller", IF(AND(P9="low", R9="high"), "Workhorse", IF(AND(P9="high", R9="low"), "Challenge", ""))))
Please note, if you use Russian of European localization of Office, you may need to replace commas with semicolons in the formula (depending on which List Separator is set in your Regional Settings).
Thanks so much! Problem solved
Удачи
Hello,
Beginner here..I am trying to get a range of cells containing text and display only the most severe result.
My formula that works for only 2 results:
=IF(COUNTIF(F5:F10,"Not OK")>0, "Not OK", "OK")
what i am trying to do is add a "Ok But" text result.
So if there is at least one "Not Ok" with multiple "Ok Buts" the result should be "Not Ok"
If i have at least one "Ok But", no "Not Ok", i need it to show "Ok But"
If all are Ok it should result "Ok"
Thanks
Nevermind,
=IF(COUNTIF(F5:F10, "not ok")>0,"Not Ok",IF(COUNTIF(F5:F10, "Ok But")>0,"Ok But","Ok"))
How can I make a formula to test two different conditions?
For the first condition there are 8 different outcomes.
For the second condition there are 4 different outcomes, however for this one the outcomes are in range of numbers.
ex: 0-1000 = outcome A or 1001-1000=result B
Suppose I get result X for first condition
and for second I get result B however this result needs to be defined by a range of numbers that is directly related to result X.
Ex. Ranges:
00-10 = A
11-20 = B
21-30 = C
31-40 = D
and
there's another variable that changes each level.
variable x
so the above ranges are true if X = 1
however if x=2 then
ranges change for A-D
How can I write a formula to that will tell me the range letter (A-D) if the range changes depending on variable x?
I still don't know who to do if for a range
can you please explain
Like if 300-400 then 1
if 200-299 then 2
if 100- 199 then 3
if < 100 then 4
How can I do that, thanks
Update.
Russes answer in the comments gave me what I needed.
I was able to nest 32 if statements!
Does anyone know how to define a function in Excel?
Ex. I want:
Weekly = 52
Biweekly=26
Monthly=12
Everything else (literally)=1
Is this possible in excel?
I mean variable not function.
hi i need to get this: if between -10 and 5= 5 if between -15 and 10= 4, if between -25 and 15=3, if between -35 and 25=2 and if btween -45 and 35= 1 im having trouble i can use IF and AND but i just get 5 and 4.
please help
these are the formulas i've use
=IF(AND(H6>=-10,H6<=5),"5","4")
=IF(H57=6,"4",IF(H57>15,"3",IF(H57=25,"2","0")))))
Hi Mike,
The point is that your conditions are not mutually exclusive, and lots of numbers fell into all of the categories. For example, number 1 is between -10 and 5, but it is also between -35 and 25, and so on.
In nested functions, Excel checks the conditions in the order they appear in a formula, and if a condition is met, subsequent conditions are not checked. So, I'd advise you either reconsider the logic, or input the conditions in the order of importance.
Hi programmers!
Good day!
I need your program expertise in excel for the ff:
if the program detect the below given Integers (1,2,etc...) it will show the corresponding value (see values).
1 = Approved - May Proceed (Re-Submission Required)
2 = Approved With Comment
3 = Not Approved / Rejected
7 = See Remarks
8 = For Retention
10 = Approved (Re-Submission not Required)
12 = No Comment
AFC = Approved for Construction
AWH = Approved with Comment
Thank you for your respond..
Please help:
Employee subgroup:: MR/Grade 1
• Area I (Jabotabek, Surabaya, Denpasar, Sulawesi, Pekanbaru, Tanjung Pinang, and Riau): IDR 420,000 / month
• Area II (All others except Area I and III: Bandar Lampung, Bandung, Bogor, Cirebon, Jambi, Yogyakarta, Malang, Medan, Padang, Palembang, Solo): IDR 360,000 / month
• Area III (Kalimantan, Batam): IDR 450,000 / month
Employee subgroup: FLSM/Grade 2
• Area I (Jabotabek, Surabaya, Denpasar, Sulawesi, Pekanbaru, Tanjung Pinang, and Riau): IDR 540,000 / month
• Area II (All others except Area I and III: Bandar Lampung, Bandung, Bogor, Cirebon, Jambi, Yogyakarta, Malang, Medan, Padang, Palembang, Solo): IDR 500,000 / month
• Area III (Kalimantan, Batam): IDR 600,000 / month
I want to use the if function but I can't include the employee subgroup.
this was my current formula:
Employee subgroup:: MR/Grade 1
=IF(G17="Area 1", "420,000", IF(G17="Area 2", "360,000", IF(G17="Area 3", "450,000", "")))
Employee subgroup: FLSM/Grade 2
=IF(G33="Area 1", "540,000", IF(G33="Area 2", "500,000", IF(G33="Area 3", "600,000", "")))
That's why, I need to separate the employee subgroups into 2 sheets instead of combining them.
Hi,
I need to create an IF/AND formula based on the information below.
FOR EXAMPLE:
If Cell 'A2' = Very Low & Cell 'B2' = Very Low......then I want Cell 'C2'= 2 (and vice versa)
If Cell 'A3' = "Very High" & Cell 'B3'= Very High.....then Cell 'C3'= 4
(and vice versa)
If Cell 'A4' = Very High & Cell 'B4'= Very Low......then Cell 'C4'= 3
(and vice versa)
So far my formula is =IF((AND(A2="Very Low",B2="Very Low")), "2").....
Please help on how to complete the formula to include the other possible variations
I am having difficulties with the below formula.
=IF(A10&C10&D10="Corrugated & Trimdeck .42 Colorbond Re-roofing"&"28-34 Degree Pitch"&"<=99",E34,)
In this specific example:
A10 = Corrugated & Trimdeck .42 Colorbond Re-roofing
C10 = 28-34 Degree Pitch
D10 = the figure entered is anywhere between 0 and 99
E34 = a cost of $10 should be returned as entered in E34
It does not return the number as detailed in E34, only a 0.
Can I have 3 rules in the one formula?
Hi there, I was wondering if someone could please help with a formula I am trying to put together.
I have sent an e-mail with sample data on support@ablebits.com
I have some text in Column A (around 8,000 rows) and I would like to shortlist that into 10 categories. I am not sure if its possible to put a "If" formula if there was one because of complications around the formatting in Column A.
Can you please help or suggest a way to do this more efficiently as this would be my monthly process.
Thanks in anticipation.
Hi trying to build the following formula:
If Cell G3 = 1 and Cell I3 = 36 Return "-2"
If Cell G3 = 1 and Cell I3 = 37 Return "-3"
If Cell G3 = 1 and Cell I3 = 38 Return "-4"
The formula I have written is:
=IF(AND(G3="1"(I3>37,"-4",IF(I3=37,"-3",IF(I3=36,"-2","0")))))
This doesn't appear to work. Could you help?
Hi Russ,
Try the following syntax:
=IF(AND(G3=1,I3>37),-4, IF(AND(G3=1,I3=37),-3, IF(AND(G3=1,I3=36),-2,0)))
Please note that in Excel formulas, you should not enclose numbers in double quotes unless you want them to be treated as text values.
Hi, I'm trying to build a formula with 3 logic tests as follows:
If cell E4 is blank then = blank
If cell G4 plus 29 days is < today’s date then = Compliant
If cell G4 plus 28 days is < today’s date then if true = Review required if not Overdue
Below is what I have in Excel
=IF(ISBLANK(E4),"", IF((G17+29)<TODAY(),"Compliant",IF((G4+28)<TODAY(),"Overdue","Review required"))
Everything appears to work except for IF((G17+29)<TODAY(),"Compliant"
What is wrong with my formula?
Hi Claire,
That's probably because in your formula it's IF((G17+29)<TODAY() while the condition reads "cell G4 plus 29 days". Please check this.
Hi,
I need your help with a simple formula but it`s giving me a hard time. I need the result to be
if(b=0,"100", if(f=0,0), if not f/b
I do not seem to make the formula work. Would you please help?
Guddu,
A1 being previous sales, A2 being current sales.
=IF(A1>A2,A1,A2)
i want to create a marks card, as like class 12th marks card in india , so plz which formula i use in it give me all..
If I compare two year sales and amount of previous one is greater than present month then the result will show the greater one.
Please help
awesome way too helpful .. thanks alot
Ok. Here is my issue. I am trying to reference another sheet(Sheet1) and run 2 logical tests and return the value of the corresponding B column of any that match the tests. This is what I used
=IFERROR(INDEX(Sheet1!$B$2:$B$5000,SMALL(IF(AND(""=Sheet1!$AX$2:$AX$5000,"YES"=Sheet1!$CV$2:$CV$5000),ROW(Sheet1!$AX$2:$AX$5000:Sheet1!$CV$2:$CV$5000)-ROW($A$2)+1),ROW(1:1))),"")
When the logical if statements are done separately they seem to work but together they do not. this is a modified version of this formula
=IFERROR(INDEX(Sheet1!$B$2:$B$5000,SMALL(IF("NEW"=Sheet1!$O$2:$O$5000,ROW(Sheet1!$O$2:$O$5000)-ROW($A$2)+1),ROW(1:1))),"")
This formula is similar and works but I have not been able to get 2 logical tests to work together properly.
Anyone willing to give this one a shot that would be awesome.
I am trying to create a formula to reference a certain cell's text. What I want it to do is input a value based on what text is in a certain cell. For example, I want it to refer to cell E6 and if it is biannual, I want it to input 2. If it's annual, I want it to input 1, if it's monthly, I want it to input 12, and if it's quarterly, I want it to input 4. Can it do something like that?
Yes. That should be very simple to create. Multiple (If) statements will get that done.
Hi,
IF A1 is greater than A2 then value=B1, and if A1 is greater than A3 then value=b2 or B1.
I am calculation plan value for my forecasted date vs my data date. Kindly advise.
Thanks.
I need an IF formula for:
IF P20 equals 83-100, Highly Effective
IF P20 equals 66 – 82, Effective
IF P20 equals 53 – 65, Needs Improvement
IF P20 equals 0 - 52, Unsatisfactory
Hi Jackie,
You need a nested IF formula like this:
=IF(P20>=83, "Highly Effective", IF(P20>=66, "Effective", IF(P20>=53, "Needs Improvement", "Unsatisfactory")))
Looking for assistance with the following:
If the date in E2 is prior to today AND L2 is less then 0 then return CHECK if false then return OK
Hi Stacey,
Here you are:
=IF(AND(E2<TODAY(), L2<0), "CHECK", "OK")
IF A1= "any value" then A1= sum of B1,B2 or "zero"
Please advise. Thanks.
Hi Riyaz,
Here you go:
=IF(A1<>"", B1+B2, 0)
Thank you so much Svetlana Cheusheva
A1 = RECEIVED / CANCELLED / DECLINED (Dropdown)
If A1="CANCELLED" then A2, A3, A4... will show CANCELLED
If A1="DECLINED" then A2, A3, A4... will show DECLINED
but
If A1="RECEIVED" then A2, A3, A4... must be blank
Please advise. Thank you
HI BRENDA,
TRY THIS
=IF(A1="CANCELLED","CANCELLED","")&IF(A1="DECLINED","DECLINED","")&IF(A1="RECEIVED","","")
Hi Svetlana,
I am having a bit trouble with the IF function with ISNUMBER and FIND/SEARCH to match and substitute strings. However, I am not getting the desired outcome. Let say, Cell 1 has string "Kara", Cell 2 has "Karam".This is my formula =IF((ISNUMBER(FIND(A1,A2))),SUBSTITUTE(A1,A1,A2),A2). Now, it is substituting Cell 1 string with Cell 2. However, I want it to substitute on the basis of full name. For instance, if Cell 2 had "Kara & Jones", then it should substitute, not only if the same characters are found. Any comments or directions would be highly appreciated!thx
Guys,
If you have any suggestions regarding my problem, I would be grateful!
I want to make this formula works:
if cell B2=0 then Cell C2=0 if cell B is not equal 0 then use this formula (C2*25)+25) to calculate the result of cell C2
Here i am attaching two sheets, One interest rate. The other interest charged. I want to have a clear sheet when ever there is change in interest based on the balance rate to be charged monthly. I want to know what the formula to be used.
sheet 1
FROM TO INT RATE
31-03-2011 24-04-2011 8.25
25-04-2011 11-05-2011 8.50
12-05-2011 10-07-2011 9.25
11-07-2011 12-08-2011 9.50
13-08-2011 19-09-2012 10.00
20-09-2012 03-02-2013 9.75
sheet2
DATE DR CR BALANCE NO.OF DAYS
31-03-2011 45455604 45455604 30 24 5
30-04-2011 394156 45849760 1
01-05-2011 394156 45455604 11
12-05-2011 3000100 42455504 19
31-05-2011 425189 42880693 1
01-06-2011 425189 42455504 29
30-06-2011 401292 42856796 1
01-07-2011 401292 42455504 7
08-07-2011 921233 41534271 23
31-07-2011 413676 41947947 1
01-08-2011 413676 41534271 30
31-08-2011 425299 41959570 1
01-09-2011 425299 41534271 29
30-09-2011 418187 41952458 0
01-10-2011 418187 41534271 30
31-10-2011 432127 41966398 1
01-11-2011 432127 41534271 2
03-11-2011 432127 41966398 14
17-11-2011 432127 41534271 13
30-11-2011 420218 41954489 1
01-12-2011 420218 41534271 30
31-12-2011 432127 41966398 1
01-01-2012 41966398 23
24-01-2012 66112 42032510 7
31-01-2012 370511 42403021 29
29-02-2012 412703 42815724 2
02-03-2012 432127 42383597 29
31-03-2012 441109 42824706 30
actually interest charged is 394156 but according to my cal Outstanding 45455604 * 24 days *8.25%/365 + 45455604*5 days *8.50/365 should be my interest
What is the formula used by combing sheet 1 and sheet2 to calculate the interest
Using Google Sheets.
I have a formula that is using validated data to display a value in a field:
=IF(H3="0X0", "$0.00", IF(H3="12 x 2", "$120.00", IF(H3="15 x 3", "$220.00", IF(H3="19 x 4", "$380.00", IF(H3="10 x 7", "$350.00")))))
This works perfectly, however, I cannot get total of the values returned. I am using the following formula: =Sum(I3,G3,E3,C3)
Don't worry I figured it out: remove the '$' from the formula and use =Sum(I3+G3+E3+C3)
Using Google Sheets.
I have a formula that is using validated data to display a value in a field:
=IF(H3="0X0", "$0.00", IF(H3="12 x 2", "$120.00", IF(H3="15 x 3", "$220.00", IF(H3="19 x 4", "$380.00", IF(H3="10 x 7", "$350.00")))))
This works perfectly, however, I cannot get total of the values returned. I am using the following formula: =Sum(I3,G3,E3,C3)
I have three worksheets that contain about 50 customer names. How can I assign the salesman name (forth worksheet) to each customer? I would like to do something like: if sheet1 list customer xxx, yyy and zz,their salesmen is A.
Thanks for the advise
HOW TO FIND EARLIEAST DATE CELL CONTAINS TEXT AND D DATE . 28 29-Nov-15 02-Dec-15 09-Dec-15 55 06-Dec-15 09-Dec-15 16-Dec-15
NO THANKS AND I WILL FIND THE ANSWER
HOW TO DO THIS QUESTION
CALCULATE THE CHARGE VALUE BY USING IF FUNCTION
Name units charge
raja 250 condition
kumar 150 0 to 200 - 1UNIT - Rs 6
sasi 800 200 to 500 - 1UNIT - Rs 9
mala 469 >500 - 1UNIT - Rs 12
raciga 640
uthayan 68
susila 342
CALCULATE THE CHARGE VALUE BY USING IF FUNCTION
Name units CHARGE
raja 250
kumar 150
sasi 800
mala 469
raciga 640
uthay 68
susila 342
Thanks, found this really useful! :)
Hi Svetlana, I really love your site, it has helped me multiple times.
I'm currently trying to figure out a way to efficiently write a nested if statement that doesn't involve manually writing it, as I will have 52 nested ifs when finished. I was trying to concatenate the pieces of my formula, but I'm having no luck. Do you have any other ideas? Ultimately what I'm trying to do is have Excel look in one column for a value >0 and if it detects it, show a value from an adjacent cell....then I want to average those numbers.
I need a formula that does the following:
IF the value in cell B1 is BLANK, then return "BLANK"
IF the value in cell B1 is TEXT, then return "Available"
IF the value in cell B1&C1 is TEXT, then return "Filled"
I need help with a formula for conditional formatting.
IF cell D12 is blank and the date in cell C12 is within 14 days of today's date, then the text is formatted red.
Hi Carrie,
Does "within 14 days of today's date" mean 14 days in the past or in the future?
If the target date in C12 is less than 14 days from today.
So, target date is 11/15/15 it would be highlighted because it is due within 14 days.
Hi Carrie,
Select the cells (or rows) you want to format red beginning with row 12 and create a conditional formatting rule will the following formulas:
=AND($D12="", $C12>TODAY(), $C12-TODAY()<14)
Svetlana, it worked perfectly! Thank you for your assitance!