IF formula returning 0 or 1 depending on values in 3 cells? - excel

I'm a beginner in Excel and I've been trying to make an IF formula that will return 0 or 1 if certain conditions are met.
The formula in A3 must look at
A1 to see if A1=1111
A2 to see if A2=21,00
A2 to see if A2=24,00.
So, if A1=1111 and A2=21,00 or 24,00 the result in A3 must be 1, but if A1=1111 and A2 is any other value, A3 must be 0. LE: If in other rows the value is 1112 the formula should return 1.

Yes, use and as well as or -
=IF(AND(A1=1111,OR(A2=21,A2=24))=TRUE,1,0)
Per comments, to add more arguments, just expand the first test for the and with an or -
=IF(AND(OR(B3=1111,B3=1112,B3=1113,B3=5555),OR(C3=21,C3=22.4))=TRUE,1,0)
update
=IF(B3<>1111,1,IF(AND(B3=1111,OR(C3=21,C3=22.4))=TRUE,1,0))

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.

I am trying to find a formula that will allow me to calculate MAX/MIN without calculating anything after the current row

I want to use the Max/Min function to calculate the minimum number up to the current row, but not count anything after that row. See example below:
A B C
1 10 =MIN(A1:A1) I Want B1 to only count MIN from A1 to A1 from here, then
2 14 =MIN(A1:A2) from here I want B2 to count MIN from A1 to A2,
3 9 =MIN(A1:A3) Then A1 to A3,
4 6 =MIN(A1:A4) etc,
5 14 =MIN(A1:A5) etc.
I could go back and update each row manually, but I have over 700 rows that I want all this to apply to. Is there anyone who can help me with a solution to this problem?
Use this formula in B1, and copy downwards:
=MIN($A$1:$A1)
This is called maintaining referential integrity while writing any excel formula. It should give the desired result on copy towards right or downwards.

How do I link the content of a cell to another worksheet as opposed to the value?

I realize my title doesn't really explain what I'm asking as I don't know the correct terminology but bear with me and I'll explain my question.
I know how to link two cells so that if one changes, the other does as well (i.e. cell C3 is linked to cell E5 by selecting cell C3 and entering "=E5"). But how do I link the information in the cell to another cell?
If my worksheet looks like this:
cell B1 - Grapes, cell C1 - 50
cell B2 - Apples, cell C2 - 60
and I link cell F1 to cell C2 with "=C2". If I change the order of cell B1 and cell B2 to become alphabetical then cell F1 is no longer linked to the value in cell C2 (50) but changes to the value that now becomes cell C2 (60). How do I link cell F1 to the actual value (50) in cell C2 even if the order changes.
Help... Thank you!
Not sure if this is an efficient method; if i correctly understood your question then you can use = to link two cells For example:
Sheet one can look like this
A B C D E
1 1 2 3 4 5
2 5 4 3 2 1
3 1 2 3 4 5
Total 7 8 9 10 11
Sheet two requires cell links so you do:
TotalForA =Sheet1!A4 //output will be 7
TotalForB =Sheet1!B4 //output will be 8
.
.
.
In a simple word you can use = sign and click on whatever cell you're like to get.

EXCEL formula with multiple conditions

I am in turmoil of IF, OR and AND in Excel formula.
Basically, I have two different cells. I want to first check that each cell is have Text or Number and if its having either of it, then I want to compare both cells and display the result in Third cell.
So it would be like
IF
Cell A2 --> Check if it contains Text or Number
AND
Cell B2 --> Check if it contains Text or Number
THEN
Cell C2 --> Compare A2 and B2
Example 1: Positive
A B C
1 abc123 abc123 PASS
Example 2: Negative
A B C
1 abc123 abc113 FAIL
Example 3: Negative
A B C
1 113 113 FAIL
I hope above example will help.
So far, I've tried:
=IF((IF(OR(ISNUMBER(A2),ISTEXT(A2)),A2,""))=(IF(OR(ISNUMBER(B2),ISTEXT(B2)),B2,"")),"PASS","FAIL")
In above example, if I leave any cell empty, still it is showing Pass.
Thanks in advance...
=IF(AND(OR(ISNUMBER(A2), ISTEXT(A2)), OR(ISNUMBER(B2), ISTEXT(B2))), IF(A2 = B2, "PASS", "FAIL"), "")
I would use:
=IF(AND(ISNUMBER(A1),ISNUMBER(B1),A1=B1),"Pass",IF(AND(A1<>"",B1<>"",A1=B1),"Pass","Fail"))

Resources