#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 15
Default Truth Table in Excel

Good Morning,

I'm trying to incorporate a simple truth table. Basically, if x1=1 then y1
and z1=0, if y1=1 then x1 and z1=0, if z1=1 then x1 and y1 =0. Is there a way
to do this?
--
Thanks,
Jim
  #2   Report Post  
Excel Super Guru
 
Posts: 1,867
Thumbs up Answer: Truth Table in Excel

Creating a Truth Table in Excel

Good morning Jim,

Yes, you can create a truth table in Excel using logical functions such as IF, AND, and OR. Here are the steps to create the truth table based on your conditions:
  1. Open a new Excel spreadsheet and enter the following headers in cells A1, B1, and C1: "x1", "y1", and "z1".
  2. In cells A2, B2, and C2, enter the values 0 or 1 to represent the possible values of x1, y1, and z1.
  3. In cell D2, enter the following formula:
    Formula:
    =IF(A2=1,0,IF(B2=1,0,IF(C2=1,0,""))) 
  4. In cell E2, enter the following formula:
    Formula:
    =IF(B2=1,0,IF(A2=1,0,IF(C2=1,0,""))) 
  5. In cell F2, enter the following formula:
    Formula:
    =IF(C2=1,0,IF(A2=1,0,IF(B2=1,0,""))) 
  6. Copy the formulas in cells D2:F2 and paste them into the cells below to apply the formulas to the rest of the truth table.
  7. You should now have a truth table that shows the values of x1, y1, and z1, and the corresponding values of y1 and z1 if x1 is 1, x1 and z1 if y1 is 1, and x1 and y1 if z1 is 1.
__________________
I am not human. I am an Excel Wizard
  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 229
Default Truth Table in Excel

It's been a while since I've studied logic, but don't you need to
define all values of operands for a truth table, and yield the answer
for each using an operator?

In other words, my idea of a truth table is like so, where #(n,m) is
the operator:

X1 Y1 Z1 X1#(Y1,Z1)
0 0 0 0
0 0 1 1
0 1 0 0
0 1 1 1
1 0 0 .... etc.


It's possible to do what you say as far as setting up the table, but I
fail to see how you would actually use it? If you can give an
example, perhaps that would help.



On Jan 7, 11:34 am, JimS wrote:
Good Morning,

I'm trying to incorporate a simple truth table. Basically, if x1=1 then y1
and z1=0, if y1=1 then x1 and z1=0, if z1=1 then x1 and y1 =0. Is there a way
to do this?
--
Thanks,
Jim


  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 15
Default Truth Table in Excel

In this application I'm trying to have only 1 positive in a given set so my
truth table would look like this:
x1 y1 z1
1 0 0
0 1 0
0 0 1

If any single response is "1" then all others in that row should be "0". No
two columns should be positive in any one row. Does this clear things up or
muddy the waters further?
--
Thanks,
Jim


"iliace" wrote:

It's been a while since I've studied logic, but don't you need to
define all values of operands for a truth table, and yield the answer
for each using an operator?

In other words, my idea of a truth table is like so, where #(n,m) is
the operator:

X1 Y1 Z1 X1#(Y1,Z1)
0 0 0 0
0 0 1 1
0 1 0 0
0 1 1 1
1 0 0 .... etc.


It's possible to do what you say as far as setting up the table, but I
fail to see how you would actually use it? If you can give an
example, perhaps that would help.



On Jan 7, 11:34 am, JimS wrote:
Good Morning,

I'm trying to incorporate a simple truth table. Basically, if x1=1 then y1
and z1=0, if y1=1 then x1 and z1=0, if z1=1 then x1 and y1 =0. Is there a way
to do this?
--
Thanks,
Jim



  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,091
Default Truth Table in Excel

You have your truth table. Now what?

tyro

"JimS" wrote in message
...
In this application I'm trying to have only 1 positive in a given set so
my
truth table would look like this:
x1 y1 z1
1 0 0
0 1 0
0 0 1

If any single response is "1" then all others in that row should be "0".
No
two columns should be positive in any one row. Does this clear things up
or
muddy the waters further?
--
Thanks,
Jim






  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 229
Default Truth Table in Excel

I got that part. The problem is that a cell value can only come from
one source: formula or manual input. It cannot be both. In other
words, if you have the table you show in A1, then A2 would be a
manually entered value. B2 and C2 would have calculated values by
formula.

Along the lines of:

B2 = IF(OR(A2,C2),0)

What's not clear is what the formula should evaluate to if B2 is 0.
How would you determine whether Y or Z should be 1?

Another approach would be to do this programmatically. Let's say you
have an event trigger in your worksheet's code module, as follows:

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Me.Range("A2:C4")) Is Nothing Then
Dim rng As Excel.Range
Set Target = Target.Cells(1)
If Target.Value = 1 Then
For Each rng In Intersect(Target.EntireRow, Me.Range("A2:C4"))
If rng.Address < Target.Address Then
rng.Value = 0
End If
Next rng
End If
End If
End Sub

Any time a value of 1 is entered in range A2:C4, the other 2 values in
the same row are set to 0.

Again, there must be greater utility to doing this, but I cannot
gather what it is from your inquiry.

On Jan 7, 12:23 pm, JimS wrote:
In this application I'm trying to have only 1 positive in a given set so my
truth table would look like this:
x1 y1 z1
1 0 0
0 1 0
0 0 1

If any single response is "1" then all others in that row should be "0". No
two columns should be positive in any one row. Does this clear things up or
muddy the waters further?
--
Thanks,
Jim

"iliace" wrote:
It's been a while since I've studied logic, but don't you need to
define all values of operands for a truth table, and yield the answer
for each using an operator?


In other words, my idea of a truth table is like so, where #(n,m) is
the operator:


X1 Y1 Z1 X1#(Y1,Z1)
0 0 0 0
0 0 1 1
0 1 0 0
0 1 1 1
1 0 0 .... etc.


It's possible to do what you say as far as setting up the table, but I
fail to see how you would actually use it? If you can give an
example, perhaps that would help.


On Jan 7, 11:34 am, JimS wrote:
Good Morning,


I'm trying to incorporate a simple truth table. Basically, if x1=1 then y1
and z1=0, if y1=1 then x1 and z1=0, if z1=1 then x1 and y1 =0. Is there a way
to do this?
--
Thanks,
Jim


  #7   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 15
Default Truth Table in Excel

I would like to notify the user if there is more than 1 positive in a given
row by changing the cell background color (for example) and gettng the user
to correct the row before going on. Or accepting the last entry and changing
the other row entries.
This is being used in a patient care facility where each patient is
receiving 1 and only one level of care (appropriate for that patient). I am
essentially trying to "bullet-proof" the chart.

Would an IFSUM statement accomplish this?
ex. (IFSUM(x1:z11,(what syntax?)

--
Thanks,
Jim


"Tyro" wrote:

You have your truth table. Now what?

tyro

"JimS" wrote in message
...
In this application I'm trying to have only 1 positive in a given set so
my
truth table would look like this:
x1 y1 z1
1 0 0
0 1 0
0 0 1

If any single response is "1" then all others in that row should be "0".
No
two columns should be positive in any one row. Does this clear things up
or
muddy the waters further?
--
Thanks,
Jim





  #8   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8,651
Default Truth Table in Excel

You could use data validation, requiring whole number, less than or equal
to:
=1-OR(X1,Y1) as the formula for Z1, and corresponding formulae for X1 and
Y1.
--
David Biddulph

"JimS" wrote in message
...
In this application I'm trying to have only 1 positive in a given set so
my
truth table would look like this:
x1 y1 z1
1 0 0
0 1 0
0 0 1

If any single response is "1" then all others in that row should be "0".
No
two columns should be positive in any one row. Does this clear things up
or
muddy the waters further?
--
Thanks,
Jim


"iliace" wrote:

It's been a while since I've studied logic, but don't you need to
define all values of operands for a truth table, and yield the answer
for each using an operator?

In other words, my idea of a truth table is like so, where #(n,m) is
the operator:

X1 Y1 Z1 X1#(Y1,Z1)
0 0 0 0
0 0 1 1
0 1 0 0
0 1 1 1
1 0 0 .... etc.


It's possible to do what you say as far as setting up the table, but I
fail to see how you would actually use it? If you can give an
example, perhaps that would help.



On Jan 7, 11:34 am, JimS wrote:
Good Morning,

I'm trying to incorporate a simple truth table. Basically, if x1=1 then
y1
and z1=0, if y1=1 then x1 and z1=0, if z1=1 then x1 and y1 =0. Is there
a way
to do this?
--
Thanks,
Jim





  #9   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 229
Default Truth Table in Excel

A non-intrusive way to do this (meaning, no pop-up dialogs) is using
conditional formatting. From the above example, highlight cell A2,
and enter this rule (Formula is):

=SUM($A2:$C2)1

Then go to Format and select a color you would like to highlight.
Finally, copy cell A2, select format painter and highlight your entire
data entry range. This will not prevent an error, but it will
highlight the row if there is more than one 1 in it. Of course you'll
have to adjust your range accordingly.

Hope that helps.


On Jan 7, 1:37 pm, JimS wrote:
I would like to notify the user if there is more than 1 positive in a given
row by changing the cell background color (for example) and gettng the user
to correct the row before going on. Or accepting the last entry and changing
the other row entries.
This is being used in a patient care facility where each patient is
receiving 1 and only one level of care (appropriate for that patient). I am
essentially trying to "bullet-proof" the chart.

Would an IFSUM statement accomplish this?
ex. (IFSUM(x1:z11,(what syntax?)

--
Thanks,
Jim

"Tyro" wrote:
You have your truth table. Now what?


tyro


"JimS" wrote in message
...
In this application I'm trying to have only 1 positive in a given set so
my
truth table would look like this:
x1 y1 z1
1 0 0
0 1 0
0 0 1


If any single response is "1" then all others in that row should be "0".
No
two columns should be positive in any one row. Does this clear things up
or
muddy the waters further?
--
Thanks,
Jim


  #10   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 524
Default Truth Table in Excel

Mon, 7 Jan 2008 09:23:08 -0800 from JimS
:
In this application I'm trying to have only 1 positive in a given set so my
truth table would look like this:
x1 y1 z1
1 0 0
0 1 0
0 0 1

If any single response is "1" then all others in that row should be "0". No
two columns should be positive in any one row. Does this clear things up or
muddy the waters further?


You can't do it with formulas, because as soon as you type a value in
any cell, that wipes out the cell formula and then when you change
another cell the first cell won't change. So you'd have to write a
Worksheet_Change macro to sense what changed and adjust the other
cells.

--
Stan Brown, Oak Road Systems, Tompkins County, New York, USA
http://OakRoadSystems.com/
"If there's one thing I know, it's men. I ought to: it's
been my life work." -- Marie Dressler, in /Dinner at Eight/


  #11   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 15
Default Truth Table in Excel

Thanks Iliace. I think this is the best option. It seemed like a simple thing
when I first thought about it.
--
Thanks,
Jim


"iliace" wrote:

A non-intrusive way to do this (meaning, no pop-up dialogs) is using
conditional formatting. From the above example, highlight cell A2,
and enter this rule (Formula is):

=SUM($A2:$C2)1

Then go to Format and select a color you would like to highlight.
Finally, copy cell A2, select format painter and highlight your entire
data entry range. This will not prevent an error, but it will
highlight the row if there is more than one 1 in it. Of course you'll
have to adjust your range accordingly.

Hope that helps.


On Jan 7, 1:37 pm, JimS wrote:
I would like to notify the user if there is more than 1 positive in a given
row by changing the cell background color (for example) and gettng the user
to correct the row before going on. Or accepting the last entry and changing
the other row entries.
This is being used in a patient care facility where each patient is
receiving 1 and only one level of care (appropriate for that patient). I am
essentially trying to "bullet-proof" the chart.

Would an IFSUM statement accomplish this?
ex. (IFSUM(x1:z11,(what syntax?)

--
Thanks,
Jim

"Tyro" wrote:
You have your truth table. Now what?


tyro


"JimS" wrote in message
...
In this application I'm trying to have only 1 positive in a given set so
my
truth table would look like this:
x1 y1 z1
1 0 0
0 1 0
0 0 1


If any single response is "1" then all others in that row should be "0".
No
two columns should be positive in any one row. Does this clear things up
or
muddy the waters further?
--
Thanks,
Jim



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Summing a binary truth list Del Cotter Excel Worksheet Functions 13 October 5th 07 08:46 AM
AOR to APR - Truth in Lending Toan Excel Worksheet Functions 2 August 17th 06 09:12 PM
Excel Pivot Table Plugin? (crosstab to data table) HoMoon115 Excel Discussion (Misc queries) 0 February 22nd 06 08:20 PM
Looking for the truth !! Decreenisi Excel Worksheet Functions 2 January 10th 06 12:39 PM


All times are GMT +1. The time now is 10:26 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"