Using IF AND and multiple conditions - excel

I need to create a formula to identify the tier based on the following conditions:
Result Conditon1 Condition2
tier_1 >=61 >=300001
tier_2 >=25 - <=60 >=100001 - <=300000
tier_3 <=24 >=0 - <=100000
I have created individual formulas but I can't put them together
=if(and(B19>=61,B1823>=300001),"Tier 1")
=IF(and(B18>=100001,B18<=300000,B19>=25,B19<=60),"Tier 2")
=if(and(B19>=0,B19<=100000,B18<=24),"Tier 3")
Your help is greatly appreciated.
Thank you,
Carlos

The usage of the Excel IF function is:
=IF(some_condition, "true", "false")
You may nest your current IF calls to get the desired logic:
=IF(AND(B19 >= 61, B1823 >= 300001), "Tier 1",
IF(AND(B18 >= 100001, B18 < =300000, B19 >= 25, B19 <= 60), "Tier 2",
IF(AND(B19 >= 0, B19 <= 100000, B18 <= 24), "Tier 3", "No Tier")))
Note that in the innermost/final IF call, I provided an else value of No Tier. This is because there has to be an else value. If you instead want everything which does not match tiers 1 and 2 to default to tier 3, then you can remove this final IF and just provide Tier 3 as the else value.

Related

IF function for if x > y, but < yz multiple by b

So this is what I’m trying to do. If the percent of an output (let’s call it A1) is <75% multiply by 0. If it’s between 75-100% multiply by 1, if it’s between 100-150% multiply by 2, etc.
Scott Craner's MATCH answer is already good in the comments. But if you are looking for a plain IF function:
=IF(A1 < 0.75, 0,
IF(A1 < 1, B1,
IF(A1 < 1.5, B1 * 2)))
Although, I recommend using IFS for readability since we can opt not to include else values due to the non-conflicting conditions.
=IFS(
A1 < 0.75, 0,
A1 < 1, B1,
A1 < 1.5, B1 * 2
)
Sample Output:
Note:
Sheets read the formula left to right (top to bottom) so if it doesn't match the first condition, it will just proceed to the next one.
Feel free to adjust the ranges if it must be inclusive to the upper limit. (e.g < to <=)
Notice that 1st and 2nd values were not multiplied by 0 and 1, as we all know, the result would be 0 and the number itself respectively thus I opted from multiplying B1 to those numbers.
Sample outputs in the sheet shown are respective to their rows.
use:
=INDEX(IFNA(VLOOKUP(A1, {0.75, 0; 1, B1; 1.5, B1*2}, 2, 0)))

Getting Excel to select from one of three range options

I'm trying to devise a dynamic spread sheet involving pension contribution percentages which increases with the age of the employees.
I've used the =now() function to calculate their ages on a dynamic basis and I now need to get excel to look at their age in cell H2 and apply the following criteria, altering automatically as their age increases into the next bracket:
if they are currently aged between 18 - 39 pension contribution is 6%
between 40 - 49 it is 7%
and over 50 it is 10%
The formula I've devised is picking up the correct percentages for those 39 & under and for those 50+ but I can't get it to recognize the 7% for those between 40 - 49.
Can anybody tell me where I'm going wrong?
=IF(H2>=OR18<=39,"6%",IF(H2>=OR40<=49,"7%",IF(H2>=OR50>100,"10%")))
Hi and welcome to Stack Overflow!
So assuming the value to test is in cell A1, the basic formula for matching within a range (say 1-10) is:
=IF(AND(A1 >= 1, A1 <= 10), "In Range", "Out of Range")
So expanding this to 3 ranges (18-39, 40-49, and 50+), and substituting your percentages, we get:
=IF(AND(A1 >= 18, A1 <= 39), "6%", IF(AND(A1 >= 40, A1 <= 49), "7%", IF(A1 >= 50, "10%")))
So a loose end that needs tying up is what to do if the age is less than 18 - currently this formula will produce FALSE. You might want to put something else in by adding a result for the second condition in the last test - so where the value doesn't match >= 50, e.g.
... IF(A1 >= 50, "10%", "NOT APPLICABLE") ...
or some other value that's appropriate.

PowerPivot DAX formula if then for dates

I have a column named ExpireDate in my PowerPivot table (not PowerBI) and want to make another column based on the value of Today's Date - ExpireDate with a DAX formula like below:
=if(Format([ExpireDate] -today(), "General Number") <= 90, "Less than 3 months",
if(90 < Format( [ExpireDate] -today() ,"General Number") <= 180, " 3 to 6 months",
if([Format (ExpireDate]-today() ,"General Number") > 180, "More than 6 months","Other"))
But this formula keeps showing error messages, saying it needs a proper formula. Anybody knows how to deal with this problem? Thanks a lot.
Assuming you are using Excel 2016, and your table name is "Table":
=
VAR Expiration = Table[ExpireDate] - TODAY ()
RETURN
SWITCH (
TRUE (),
Expiration <= 90, "Less than 3 months",
Expiration <= 180, " 3 to 6 months",
Expiration > 180, "More than 6 months",
"Other"
)

Nested IF Statement (price bands)

I am trying to create a formula using the following parameters:
=IF(E20<=500,E20*.90,IF(E20<=1000,E20*.80,IF(E20<5000,E20*.70,IF(E20<=10000,E20*.60,IF(E20<999999,E20*.50
I want the formula to calculate the price if the quantity falls within the range but am missing something with the formula above.
Could someone please point out the mistake and offer a suggestion or correction?
Since struggling with nested IFs (understandably!) you might be better off with a lookup table. Say name an array as below LT;
1 0.9
500 0.8
1000 0.7
5000 0.6
10000 0.5
and apply =VLOOKUP(E20,LT,2)*E20
With this, you check if cell A1 value falls between 100 and 200
=IF(A1 < 200; IF(A1 > 100; "ok"; "no"); "no")
Instead of "ok", you can insert your price calculation.
With this, you check if A1 < 100, if it is not then it checks if A1 < 200, and again if not it checks if A1 < 1000. If none of these conditions are true, it says "A1 > 1000"
=IF(A1 < 100; "A1<100"; IF(A1 < 200; "A1 < 200"; IF(A1 < 1000; "A1 < 1000"; "A1 > 1000")))
Again, instead of the optut string, you can insert your price calculation
Hope it helps, regards

How do I create a formula for "if x ≥ then multiply by y" and so on?

I've only used Excel for the basics.
I want to multiply the contents of the cell by a different number depending on the value in the cell. I have these ranges:
0 - 499, then multiply by 0
500 - 999, then multiply by 1
1000 - 1499, then multiply by 4
I was able to figure out the formula =IF(C21>=10000,C21*1) for if a value in cell C21 is greater than or equal to 10,000, but I don't see how to extend that to multiple ranges.
How can I write a formula to handle the multiple ranges I've listed above?
You can use another IF in the ELSE part of the expression, evaluation will stop as soon as a TRUE condition is met;
=A1 * IF(A1 < 500, 0, IF(A1 < 1000, 1, IF(A1 < 1500, 4, 0)))
(The last 0 is the case when the value is > 1499)
You can use nested IF statements for doing ranges:
=IF(C21>=500,IF(C21>=1000,IF(C21<1500,C21*4,'dontknowwhatyouwanthere'),C21*1),0)
How about nested Ifs?
=IF(A1<1000;IF(A1<500;+A1*0;+A1*1);+A1*4)
Then you've got:
If it's less than 1000 another if:
If it's less than 500 You do the " * 0 "
If it's not (you are at 500-999 range, from the first if) You do the " * 1 "
Else it's not less than 1000:
You have your " * 4 "
I used this formula and it worked:
=V4*IF(V4<600,0.2,IF(V4<800,0.22,IF(V4<1000,0.25,IF(V4<10000,0.27))))

Resources