Excel: IF statement with 3 possible outcomes (2 times text, 1 empty cell) - excel

Situation:
Cell A1 is a number (age of a person)
Cell B1 generates one of 2 texts.
I can't get to the solution of this: If A1 is greater than 14 and less or equal to 17, it should give text A. If A1 is greater than 17, it should give text B. If A1 is empty, B1 should stay empty too.

Nested IF
=IF(A1>17,"A",IF(A1>14,"B",""))

Related

Input data into a 2nd cell, based on the value of a 3rd cell? (Like "conditional formatting")

B1 is a checkbox. If checked B1=1. A1 can range from 0 to 10. If B1 is checked I want A1 to automatically = 10. Exactly like conditional formatting would turn it green. I cant put the formula =IF(B1=1,10,"") into A1 though because I need to be able to input other values in A1 without erasing the formula. I need to be able to reuse the sheet multiple times.
Ex.
A B
1 10 x
2 9
3 10 x
4 4
As Scott commented, you'd need to use VBA to do exactly what you're asking. A work-around, though, would be to add a third column with:
=IF(B1="x",10,A1)
In this case, Column A would be the user-inputted number, Column B would be your "x", and Column C would give the final output: 10 if B has "x", and the number from A otherwise.

Formula to add a number to the cell and change that value if it is greater than certain number

In Column A I have numbers from 1 to 30 and in Column B I want to add 10 to the number in column A i.e.
if A1 is 1 I want 11 in B1 and in C1 I want 21 and
if A2 is 2 I want 12 in B2 and in C2 I want 22.
I don't want the numbers in columns B and C to exceed the maximum limit of numbers I have in Column A, in this case that is 30.
I need a formula to achieve this so that none of the cells in column B and C has the number exceeding 30 and if the addition exceeds that I want 30 to be subtracted from it. I tried this with IF but it didn't help as I don't know how to manipulate the current cell after adding the number.
Screenshot of expected results:
I want the number in B Column to be addition of 10 to the number in A Column and it should not exceed maximum number.
Maybe, in B1:
=A1+10-30*(A1+10>30)
and in C1, both copied down to suit:
=B1+10-30*(B1+10>30)
Considering B1, the above can be simplified slightly by rendering (A1+10>30) down to (A1>20).
A1+10 is the basic requirement.
The condition is that where A1+10 exceeds 30, a deduction of 30 should be applied. This can be restated as "where A1 exceeds 20".
(A1>20) returns either TRUE (when A1 is more than 20) and FALSE (otherwise).
What may not have been appreciated by all is that when used as a multiplier, Excel treats TRUE as 1 and FALSE as 0.
So when A1 is less than or equal to 20, nothing is deducted from to A1+10. 30*(A1>20) becomes 30*FALSE (effectively 30*0), which is 0. However, when A1 is more than 20 30*(A1>20) becomes 30*TRUE (effectively 30*1), which is 30.
The formula for B1 is:
=IF(A1+10>MAX($A$1:$A$30),A1+10-MAX($A$1:$A$30),A1+10)
(For C1 just do "Fill Right" from B1.)
Sometimes it's better to use several columns to get to the result:
First I created in D1 =A1+10, then in E1 =MAX($A$1:$A$30).
The $ means that the column or row number does not change when you fill down, so A1 stays fixed to A1 in every cell.
In F1 I created an IF formula: =IF(D1>$E$1,D1-$E$1,D1) which means "IF D1 exceeds the highest value in A1 to A30 THEN subtract that highest value from D1 ELSE just display D1 (=A1+10)"
And if you substitute these values:
(E1): =IF(D1>MAX($A$1:$A$30),D1-MAX($A$1:$A$30),D1)
(D1): =IF(A1+10>MAX($A$1:$A$30),A1+10-MAX($A$1:$A$30),A1+10)
you get the result I mentioned in the first place.

Dragging formulas across - Increment columns by more than 1

I can't seem to find anything similar that's already been asked (they all relate to incrementing row numbers rather than columns)
I'm looking to drag a formula across horizontally and have the columns increment by 2
E.g. B1-A1, D1-C1, F1-E1...
Thanks!
You'll need to have a value in cell A1 and B1 for the following to work.
For my testing I put the number 1 in A1 and B1.
Try this in Cell C1:
=IF(MOD(COUNT($A$1:B1),2)=0,COLUMN(B1),IF(B1<>A1,B1,A1))
Here's what you should see when you drag that formula across:
A B C D E F G H I J K L M N
1 1 2 2 4 4 6 6 8 8 10 10 12 12
And this is what the formula does:
The MOD(COUNT() part of the formula counts the cells to the left of it, and if they are a multiple of 2, the value changes.
I've left the value to change to (the 'new' value) as the COLUMN() number for the cell before, just for example's sake. but you can change this part.
The last IF statement at the end checks if the cell before is equal to the cell before that, (eg. Is CELL C1 equal to CELL B1) and if they are not equal, it will give the cell before as a value (the 'copy' value).

Excel. Convert text to values and calculate the values in a formula

I want to convert text to values and then with this values calculate a result:
Text "A" is always = 8
Text "B" is always =7
In my sheet:
In cell A1:"A" and in B1: "B". Now in cell C1 I want the sum of A1 and B1 (8+7=15).
I always want the cells A1 och B1 to show text not values.
And if it possible I dont want any intermediate cells that convert A1 to 8 and B1 to 7 so the resultformula points at that intermdediate cells. I want my result (C1) to calculate the text cells directly. Is this possible?
=IF(A1="A",8,IF(A1="B",7,NA()))*IF(B1="A",8,IF(B1="B",7,NA()))
It is easier to have a separate translation list, say on Sheet2 cells A1:B6:
A 8
B 7
C 6
D 5
E 4
F 3
and then use:
=VLOOKUP(A1,Sheet2!$A$1:$B$6,2,FALSE)*VLOOKUP(B1,Sheet2!$A$1:$B$6,2,FALSE)

Change value in a cell based on value in another cell

Searched for this but could not find a way to do it.
I would like to be able to transform a value in one cell to another value in a different cell like this:
When cells in Column A contain Y set same number cells in Column B to Male or when cells in Column A contains N set same number cells in Column B value to Female.
For instance:
A2 = Y then B2 = Male
A2 = N then B2 = Female
=IF(A2="Y","Male",IF(A2="N","Female",""))
by typing yes it wont charge taxes, by typing no it will charge taxes.
=IF(C39="Yes","0",IF(C39="no",PRODUCT(G36*0.0825)))
If you want to do something like the following example, you'd have to use nested ifs.
If percentage is greater than or equal to 93%, then corresponding value in B should be 4 and if the percentage is greater than or equal to 90% and less than 92%, then corresponding value in B to be 3.7, etc.
Here's how you'd do it:
=IF(A2>=93%, 4, IF(A2>=90%, 3.7,IF(A2>=87%,3.3,0)))

Resources