(excel) Change value of a cell based on another value
up vote
1
down vote
favorite
Im trying to a IF statement in excel that gives a result based on the value of another cell. So for instance if cell A10 has a value of 10780 i want the cell D10 to have a value of 90310011. I can do this with the code: =IF(A10=10780;90310011). This works
However, i want to be able to add more values with corresponding new numbers in the same cell. So if the first cell was 10782 i want the value to be 90310012
As you can see in the picture i tried to do this with AND and also with OR. I get the result 0 with both so its not working.
Does anyone know how i should do this?
Thanks,
microsoft-excel
add a comment |
up vote
1
down vote
favorite
Im trying to a IF statement in excel that gives a result based on the value of another cell. So for instance if cell A10 has a value of 10780 i want the cell D10 to have a value of 90310011. I can do this with the code: =IF(A10=10780;90310011). This works
However, i want to be able to add more values with corresponding new numbers in the same cell. So if the first cell was 10782 i want the value to be 90310012
As you can see in the picture i tried to do this with AND and also with OR. I get the result 0 with both so its not working.
Does anyone know how i should do this?
Thanks,
microsoft-excel
The current two answers give you nested IFs as a solution. But VLOOKUP is your friend if you are going to have more values - easier to read and much more maintainable.
– Jan Doggen
Dec 7 '16 at 14:36
add a comment |
up vote
1
down vote
favorite
up vote
1
down vote
favorite
Im trying to a IF statement in excel that gives a result based on the value of another cell. So for instance if cell A10 has a value of 10780 i want the cell D10 to have a value of 90310011. I can do this with the code: =IF(A10=10780;90310011). This works
However, i want to be able to add more values with corresponding new numbers in the same cell. So if the first cell was 10782 i want the value to be 90310012
As you can see in the picture i tried to do this with AND and also with OR. I get the result 0 with both so its not working.
Does anyone know how i should do this?
Thanks,
microsoft-excel
Im trying to a IF statement in excel that gives a result based on the value of another cell. So for instance if cell A10 has a value of 10780 i want the cell D10 to have a value of 90310011. I can do this with the code: =IF(A10=10780;90310011). This works
However, i want to be able to add more values with corresponding new numbers in the same cell. So if the first cell was 10782 i want the value to be 90310012
As you can see in the picture i tried to do this with AND and also with OR. I get the result 0 with both so its not working.
Does anyone know how i should do this?
Thanks,
microsoft-excel
microsoft-excel
edited Dec 7 '16 at 13:54
User552853
1,326924
1,326924
asked Dec 7 '16 at 13:27
Rudy
612
612
The current two answers give you nested IFs as a solution. But VLOOKUP is your friend if you are going to have more values - easier to read and much more maintainable.
– Jan Doggen
Dec 7 '16 at 14:36
add a comment |
The current two answers give you nested IFs as a solution. But VLOOKUP is your friend if you are going to have more values - easier to read and much more maintainable.
– Jan Doggen
Dec 7 '16 at 14:36
The current two answers give you nested IFs as a solution. But VLOOKUP is your friend if you are going to have more values - easier to read and much more maintainable.
– Jan Doggen
Dec 7 '16 at 14:36
The current two answers give you nested IFs as a solution. But VLOOKUP is your friend if you are going to have more values - easier to read and much more maintainable.
– Jan Doggen
Dec 7 '16 at 14:36
add a comment |
3 Answers
3
active
oldest
votes
up vote
0
down vote
Nest your subsequent If statement within the false option of the first If...
=IF(A10=10780,90310011,(IF(A10=12072,90310012,(IF(A10=[etc])))))
Can get messy though.
Could you update it with a macro? or does it have to be done as a formula?
add a comment |
up vote
0
down vote
The IF formula has 3 parameters, where you only used 2.
=IF( condition ; true ; false )
The formula at the condition side is evaluated, and its either true or false.
When its true, the formula that is located in the true section will be executed.
When its false, the formula in the false section will be executed.
A formula can just be a reference to another cell or even a static value. If this is the case, this is returned.
So: =IF ( 1=2 ; "it is true" ; B4 )
will evaluate if 1=2. Its not true, so whatever value is stored in cell B4 is now returned.
Because you can also enter formulas in the true or false result, you can nest IF statements. For example:
=IF( 1=2 ; "first is true" ; IF( 1=3 ; "second is true" ; "Neither are true"))
This will result in "neither are true".
Of course, the actual condition can refer to other cells like in your question too.
add a comment |
up vote
0
down vote
It seems like your values are related by an equation... you may want to figure that out (if that's the case)
if not, then what you want are nested IF-statements. Other people seem to have pointed that out, so I'll write it down for you in a more didactic structure
=IF
(
A10=10780
,90310011
,IF
(
A10=12072
,90310012
,IF
(
A10=[...]
)
)
)
See how they're all nested whithin one another? that makes the verification of your (inner) condition dependant on the value of the (outer) condition
New contributor
add a comment |
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
Nest your subsequent If statement within the false option of the first If...
=IF(A10=10780,90310011,(IF(A10=12072,90310012,(IF(A10=[etc])))))
Can get messy though.
Could you update it with a macro? or does it have to be done as a formula?
add a comment |
up vote
0
down vote
Nest your subsequent If statement within the false option of the first If...
=IF(A10=10780,90310011,(IF(A10=12072,90310012,(IF(A10=[etc])))))
Can get messy though.
Could you update it with a macro? or does it have to be done as a formula?
add a comment |
up vote
0
down vote
up vote
0
down vote
Nest your subsequent If statement within the false option of the first If...
=IF(A10=10780,90310011,(IF(A10=12072,90310012,(IF(A10=[etc])))))
Can get messy though.
Could you update it with a macro? or does it have to be done as a formula?
Nest your subsequent If statement within the false option of the first If...
=IF(A10=10780,90310011,(IF(A10=12072,90310012,(IF(A10=[etc])))))
Can get messy though.
Could you update it with a macro? or does it have to be done as a formula?
answered Dec 7 '16 at 14:05
Mark
101
101
add a comment |
add a comment |
up vote
0
down vote
The IF formula has 3 parameters, where you only used 2.
=IF( condition ; true ; false )
The formula at the condition side is evaluated, and its either true or false.
When its true, the formula that is located in the true section will be executed.
When its false, the formula in the false section will be executed.
A formula can just be a reference to another cell or even a static value. If this is the case, this is returned.
So: =IF ( 1=2 ; "it is true" ; B4 )
will evaluate if 1=2. Its not true, so whatever value is stored in cell B4 is now returned.
Because you can also enter formulas in the true or false result, you can nest IF statements. For example:
=IF( 1=2 ; "first is true" ; IF( 1=3 ; "second is true" ; "Neither are true"))
This will result in "neither are true".
Of course, the actual condition can refer to other cells like in your question too.
add a comment |
up vote
0
down vote
The IF formula has 3 parameters, where you only used 2.
=IF( condition ; true ; false )
The formula at the condition side is evaluated, and its either true or false.
When its true, the formula that is located in the true section will be executed.
When its false, the formula in the false section will be executed.
A formula can just be a reference to another cell or even a static value. If this is the case, this is returned.
So: =IF ( 1=2 ; "it is true" ; B4 )
will evaluate if 1=2. Its not true, so whatever value is stored in cell B4 is now returned.
Because you can also enter formulas in the true or false result, you can nest IF statements. For example:
=IF( 1=2 ; "first is true" ; IF( 1=3 ; "second is true" ; "Neither are true"))
This will result in "neither are true".
Of course, the actual condition can refer to other cells like in your question too.
add a comment |
up vote
0
down vote
up vote
0
down vote
The IF formula has 3 parameters, where you only used 2.
=IF( condition ; true ; false )
The formula at the condition side is evaluated, and its either true or false.
When its true, the formula that is located in the true section will be executed.
When its false, the formula in the false section will be executed.
A formula can just be a reference to another cell or even a static value. If this is the case, this is returned.
So: =IF ( 1=2 ; "it is true" ; B4 )
will evaluate if 1=2. Its not true, so whatever value is stored in cell B4 is now returned.
Because you can also enter formulas in the true or false result, you can nest IF statements. For example:
=IF( 1=2 ; "first is true" ; IF( 1=3 ; "second is true" ; "Neither are true"))
This will result in "neither are true".
Of course, the actual condition can refer to other cells like in your question too.
The IF formula has 3 parameters, where you only used 2.
=IF( condition ; true ; false )
The formula at the condition side is evaluated, and its either true or false.
When its true, the formula that is located in the true section will be executed.
When its false, the formula in the false section will be executed.
A formula can just be a reference to another cell or even a static value. If this is the case, this is returned.
So: =IF ( 1=2 ; "it is true" ; B4 )
will evaluate if 1=2. Its not true, so whatever value is stored in cell B4 is now returned.
Because you can also enter formulas in the true or false result, you can nest IF statements. For example:
=IF( 1=2 ; "first is true" ; IF( 1=3 ; "second is true" ; "Neither are true"))
This will result in "neither are true".
Of course, the actual condition can refer to other cells like in your question too.
answered Dec 7 '16 at 14:22
LPChip
34.8k44982
34.8k44982
add a comment |
add a comment |
up vote
0
down vote
It seems like your values are related by an equation... you may want to figure that out (if that's the case)
if not, then what you want are nested IF-statements. Other people seem to have pointed that out, so I'll write it down for you in a more didactic structure
=IF
(
A10=10780
,90310011
,IF
(
A10=12072
,90310012
,IF
(
A10=[...]
)
)
)
See how they're all nested whithin one another? that makes the verification of your (inner) condition dependant on the value of the (outer) condition
New contributor
add a comment |
up vote
0
down vote
It seems like your values are related by an equation... you may want to figure that out (if that's the case)
if not, then what you want are nested IF-statements. Other people seem to have pointed that out, so I'll write it down for you in a more didactic structure
=IF
(
A10=10780
,90310011
,IF
(
A10=12072
,90310012
,IF
(
A10=[...]
)
)
)
See how they're all nested whithin one another? that makes the verification of your (inner) condition dependant on the value of the (outer) condition
New contributor
add a comment |
up vote
0
down vote
up vote
0
down vote
It seems like your values are related by an equation... you may want to figure that out (if that's the case)
if not, then what you want are nested IF-statements. Other people seem to have pointed that out, so I'll write it down for you in a more didactic structure
=IF
(
A10=10780
,90310011
,IF
(
A10=12072
,90310012
,IF
(
A10=[...]
)
)
)
See how they're all nested whithin one another? that makes the verification of your (inner) condition dependant on the value of the (outer) condition
New contributor
It seems like your values are related by an equation... you may want to figure that out (if that's the case)
if not, then what you want are nested IF-statements. Other people seem to have pointed that out, so I'll write it down for you in a more didactic structure
=IF
(
A10=10780
,90310011
,IF
(
A10=12072
,90310012
,IF
(
A10=[...]
)
)
)
See how they're all nested whithin one another? that makes the verification of your (inner) condition dependant on the value of the (outer) condition
New contributor
New contributor
answered 2 days ago
StructuralEng92
1
1
New contributor
New contributor
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1153955%2fexcel-change-value-of-a-cell-based-on-another-value%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
The current two answers give you nested IFs as a solution. But VLOOKUP is your friend if you are going to have more values - easier to read and much more maintainable.
– Jan Doggen
Dec 7 '16 at 14:36