If statement triple condition

vanther

New Member
Joined
Dec 8, 2011
Messages
24
Hi everyone I have a problem that I couldn't work out can anyone figure out this.
The table has a column of Zero, One and Two now the logic is here because I don't know how to formulate this.
See this table below

[TABLE="class: grid, width: 500, align: left"]
<tbody>[TR]
[TD][/TD]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[TD]D[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]ZERO(0)[/TD]
[TD]ONE(1)[/TD]
[TD]TWO(2)[/TD]
[TD]OUTPUT[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]0[/TD]
[TD]0[/TD]
[TD]1[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]0[/TD]
[TD]1[/TD]
[TD]0[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]1[/TD]
[TD]0[/TD]
[TD]0[/TD]
[TD]0[/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]0[/TD]
[TD]1[/TD]
[TD]1[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD]6[/TD]
[TD]0[/TD]
[TD]1[/TD]
[TD]1[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD]7[/TD]
[TD]1[/TD]
[TD]1[/TD]
[TD]0[/TD]
[TD]0[/TD]
[/TR]
</tbody>[/TABLE]














The simple logic is when the zero is "1" the output should be zero,
If One and Two is "1" the output is "2",
If One is "1" only the other is "0" the output is "1",
If Two is "1" only the other is "0" the output is "2".

Can anyone figure this out?
I don't know the formula to put in the output column.. using if else statement...

Thanks in advance....
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
Hi
Try this formula in d2 and copy it down.
=IF(A2=1,0,IF(AND(B2=1,C2=1),2,IF(AND(B2=1,C2=0),1,IF(AND(B2=0,C2=1),2))))
<textarea id="adlesse_unifier_magic_element_id" style="display: none;"></textarea>
 
Upvote 0
Hi
Try this formula in d2 and copy it down.
=IF(A2=1,0,IF(AND(B2=1,C2=1),2,IF(AND(B2=1,C2=0),1,IF(AND(B2=0,C2=1),2))))
<textarea id="adlesse_unifier_magic_element_id" style="display: none;"></textarea>

Thanks for the reply I will try this one...
 
Upvote 0
Instead of value of "1" or "0" of column A,B and C
we change it to : what if it contain numbers aside from "0"
can we do that..? so the logic is:
If zero contains number the output is "0"
If One contains number the other is "0" the output is "1"
If Two contains number the other is "0" the output is "2"
If One and two contain numbers the output is "2"

I hope this be done in excel...because nothing is impossible...^^
 
Upvote 0
In D2 enter and drag down.

=B2+C2*2

If you want to change the values in A1, B1 & C1 use this in D2 and drag down

=A2*$A$1+B2*$B$1+C2*$C$1
 
Last edited:
Upvote 0
If zero contains number the output is "0"
Do you mean output is 0 regardless of the values of 1 and 2?

If One contains number the other is "0" the output is "1"
What about 0 and 2.What do you mean by other one?

If Two contains number the other is "0" the output is "2"
What does one and 0 contain? Which one do you refer to as other?

If One and two contain numbers the output is "2"
what about zero?

If you can make a table it will be nice..




<textarea id="adlesse_unifier_magic_element_id" style="display: none;"></textarea>
 
Upvote 0

Forum statistics

Threads
1,223,234
Messages
6,170,891
Members
452,366
Latest member
TePunaBloke

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top