Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default using the IF statement

Hi Guys,

if I want to set up a a sequencve ogf numbers in rows like this:

A B c Resultant
1 1 0 1
0 1 1 0
0 1 0 0
1 0 1 1

Where the resulatant output only provides a high (1) for numbers in columns
(A and C) or (A and B) and every other combination a low (0), how would I
program something like this?? As shown above!!



Please help me as I am stuck

Cheers

Ian


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 108
Default using the IF statement

Hmm... You mean the below is a truth table and you want the If statement for
A, B and C that produces this result? But we're missing part of the table.
Let me redraw it like this and you fill in the missing parts:

TRUE,TRUE,TRUE:?
TRUE,TRUE,FALSE:TRUE
TRUE,FALSE,TRUE:TRUE
TRUE,FALSE,FALSE:?
FALSE,TRUE,TRUE:FALSE
FALSE,TRUE,FALSE:FALSE
FALSE,FALSE,TRUE:?
FALSE,FALSE,FALSE:?

The If statement that produces the results you want depends on how you fill
in the missing parts.

--- "DontKnow" wrote:
if I want to set up a a sequencve ogf numbers in rows like this:

A B c Resultant
1 1 0 1
0 1 1 0
0 1 0 0
1 0 1 1

Where the resulatant output only provides a high (1) for numbers in columns
(A and C) or (A and B) and every other combination a low (0), how would I
program something like this?? As shown above!!

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default using the IF statement

I hope this helps

"Bob Bridges" wrote:

Hmm... You mean the below is a truth table and you want the If statement for
A, B and C that produces this result? But we're missing part of the table.
Let me redraw it like this and you fill in the missing parts:

TRUE,TRUE,TRUE:? False
TRUE,TRUE,FALSE:TRUE
TRUE,FALSE,TRUE:TRUE
TRUE,FALSE,FALSE:? False
FALSE,TRUE,TRUE:FALSE
FALSE,TRUE,FALSE:FALSE
FALSE,FALSE,TRUE:? False
FALSE,FALSE,FALSE:? False

The If statement that produces the results you want depends on how you fill
in the missing parts.

--- "DontKnow" wrote:
if I want to set up a a sequencve ogf numbers in rows like this:

A B c Resultant
1 1 0 1
0 1 1 0
0 1 0 0
1 0 1 1

Where the resulatant output only provides a high (1) for numbers in columns
(A and C) or (A and B) and every other combination a low (0), how would I
program something like this?? As shown above!!

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 108
Default using the IF statement

Yes, it does. Ok, you said it the way you meant it (not everyone always
does): you want True only if A is True (or 1) and B is True (or 1) and in
every other case you want the result to be False. You don't need a program
for this - you can do it with Excel worksheet functions - but since you
specified a VBA program the statement would look something like this, I guess:

With Myworksheet
For ir = 2 to BottomRow
.Range("D1") = .Range("A1") And (.Range("B1") Xor .Range("C1"))
Next ir
End With

That's if you're using True and False rather than 1 and 0. If you have to
go with 1 and 0 it looks slightly more complicated but is really the same:

With Myworksheet
For ir = 2 to BottomRow
.Range("D1") = .Range("A1")=1 And (.Range("B1")=1 Xor .Range("C1")=1)
Next ir
End With

"A Xor B" means "if A is true or B is true but not both".

--- "DontKnow" wrote:
I hope this helps

--- "Bob Bridges" wrote:
Hmm... You mean the below is a truth table and you want the If statement for
A, B and C that produces this result? But we're missing part of the table.
Let me redraw it like this and you fill in the missing parts:

TRUE,TRUE,TRUE:? False
TRUE,TRUE,FALSE:TRUE
TRUE,FALSE,TRUE:TRUE
TRUE,FALSE,FALSE:? False
FALSE,TRUE,TRUE:FALSE
FALSE,TRUE,FALSE:FALSE
FALSE,FALSE,TRUE:? False
FALSE,FALSE,FALSE:? False

The If statement that produces the results you want depends on how you fill
in the missing parts.

--- "DontKnow" wrote:
if I want to set up a a sequencve ogf numbers in rows like this:

A B C Resultant
1 1 0 1
0 1 1 0
0 1 0 0
1 0 1 1

Where the resulatant output only provides a high (1) for numbers in columns
(A and C) or (A and B) and every other combination a low (0), how would I
program something like this?? As shown above!!

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default using the IF statement

Sorry Bob,

I can't find an XOR function anywhere in Excel??

I have also tried EXOR still no luck!!

Cheers,

THanks for your help in advance!!

"Bob Bridges" wrote:

Yes, it does. Ok, you said it the way you meant it (not everyone always
does): you want True only if A is True (or 1) and B is True (or 1) and in
every other case you want the result to be False. You don't need a program
for this - you can do it with Excel worksheet functions - but since you
specified a VBA program the statement would look something like this, I guess:

With Myworksheet
For ir = 2 to BottomRow
.Range("D1") = .Range("A1") And (.Range("B1") Xor .Range("C1"))
Next ir
End With

That's if you're using True and False rather than 1 and 0. If you have to
go with 1 and 0 it looks slightly more complicated but is really the same:

With Myworksheet
For ir = 2 to BottomRow
.Range("D1") = .Range("A1")=1 And (.Range("B1")=1 Xor .Range("C1")=1)
Next ir
End With

"A Xor B" means "if A is true or B is true but not both".

--- "DontKnow" wrote:
I hope this helps

--- "Bob Bridges" wrote:
Hmm... You mean the below is a truth table and you want the If statement for
A, B and C that produces this result? But we're missing part of the table.
Let me redraw it like this and you fill in the missing parts:

TRUE,TRUE,TRUE:? False
TRUE,TRUE,FALSE:TRUE
TRUE,FALSE,TRUE:TRUE
TRUE,FALSE,FALSE:? False
FALSE,TRUE,TRUE:FALSE
FALSE,TRUE,FALSE:FALSE
FALSE,FALSE,TRUE:? False
FALSE,FALSE,FALSE:? False

The If statement that produces the results you want depends on how you fill
in the missing parts.

--- "DontKnow" wrote:
if I want to set up a a sequencve ogf numbers in rows like this:

A B C Resultant
1 1 0 1
0 1 1 0
0 1 0 0
1 0 1 1

Where the resulatant output only provides a high (1) for numbers in columns
(A and C) or (A and B) and every other combination a low (0), how would I
program something like this?? As shown above!!



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default using the IF statement

If he is using 1 and 0, you can use this to simplify the expression a
little...

..Range("D1") = -.Range("A1") And (-.Range("B1") Xor -.Range("C1"))

Note the minus signs in front of each Range expression for those ranges to
the right of the equal sign.

Rick


"Bob Bridges" wrote in message
...
Yes, it does. Ok, you said it the way you meant it (not everyone always
does): you want True only if A is True (or 1) and B is True (or 1) and in
every other case you want the result to be False. You don't need a
program
for this - you can do it with Excel worksheet functions - but since you
specified a VBA program the statement would look something like this, I
guess:

With Myworksheet
For ir = 2 to BottomRow
.Range("D1") = .Range("A1") And (.Range("B1") Xor .Range("C1"))
Next ir
End With

That's if you're using True and False rather than 1 and 0. If you have to
go with 1 and 0 it looks slightly more complicated but is really the same:

With Myworksheet
For ir = 2 to BottomRow
.Range("D1") = .Range("A1")=1 And (.Range("B1")=1 Xor
.Range("C1")=1)
Next ir
End With

"A Xor B" means "if A is true or B is true but not both".

--- "DontKnow" wrote:
I hope this helps

--- "Bob Bridges" wrote:
Hmm... You mean the below is a truth table and you want the If
statement for
A, B and C that produces this result? But we're missing part of the
table.
Let me redraw it like this and you fill in the missing parts:

TRUE,TRUE,TRUE:? False
TRUE,TRUE,FALSE:TRUE
TRUE,FALSE,TRUE:TRUE
TRUE,FALSE,FALSE:? False
FALSE,TRUE,TRUE:FALSE
FALSE,TRUE,FALSE:FALSE
FALSE,FALSE,TRUE:? False
FALSE,FALSE,FALSE:? False

The If statement that produces the results you want depends on how you
fill
in the missing parts.

--- "DontKnow" wrote:
if I want to set up a a sequencve ogf numbers in rows like this:

A B C Resultant
1 1 0 1
0 1 1 0
0 1 0 0
1 0 1 1

Where the resulatant output only provides a high (1) for numbers in
columns
(A and C) or (A and B) and every other combination a low (0), how
would I
program something like this?? As shown above!!


  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default using the IF statement

Yes Rick,
I was trying to use the worksheet functions, rather than programming to
determine how to use the EXOR function!!

Mnay thanks for your input!!

"Rick Rothstein (MVP - VB)" wrote:

If he is using 1 and 0, you can use this to simplify the expression a
little...

..Range("D1") = -.Range("A1") And (-.Range("B1") Xor -.Range("C1"))

Note the minus signs in front of each Range expression for those ranges to
the right of the equal sign.

Rick


"Bob Bridges" wrote in message
...
Yes, it does. Ok, you said it the way you meant it (not everyone always
does): you want True only if A is True (or 1) and B is True (or 1) and in
every other case you want the result to be False. You don't need a
program
for this - you can do it with Excel worksheet functions - but since you
specified a VBA program the statement would look something like this, I
guess:

With Myworksheet
For ir = 2 to BottomRow
.Range("D1") = .Range("A1") And (.Range("B1") Xor .Range("C1"))
Next ir
End With

That's if you're using True and False rather than 1 and 0. If you have to
go with 1 and 0 it looks slightly more complicated but is really the same:

With Myworksheet
For ir = 2 to BottomRow
.Range("D1") = .Range("A1")=1 And (.Range("B1")=1 Xor
.Range("C1")=1)
Next ir
End With

"A Xor B" means "if A is true or B is true but not both".

--- "DontKnow" wrote:
I hope this helps

--- "Bob Bridges" wrote:
Hmm... You mean the below is a truth table and you want the If
statement for
A, B and C that produces this result? But we're missing part of the
table.
Let me redraw it like this and you fill in the missing parts:

TRUE,TRUE,TRUE:? False
TRUE,TRUE,FALSE:TRUE
TRUE,FALSE,TRUE:TRUE
TRUE,FALSE,FALSE:? False
FALSE,TRUE,TRUE:FALSE
FALSE,TRUE,FALSE:FALSE
FALSE,FALSE,TRUE:? False
FALSE,FALSE,FALSE:? False

The If statement that produces the results you want depends on how you
fill
in the missing parts.

--- "DontKnow" wrote:
if I want to set up a a sequencve ogf numbers in rows like this:

A B C Resultant
1 1 0 1
0 1 1 0
0 1 0 0
1 0 1 1

Where the resulatant output only provides a high (1) for numbers in
columns
(A and C) or (A and B) and every other combination a low (0), how
would I
program something like this?? As shown above!!



  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default using the IF statement

See my other response...

Rick


"DontKnow" wrote in message
...
Yes Rick,
I was trying to use the worksheet functions, rather than programming to
determine how to use the EXOR function!!

Mnay thanks for your input!!

"Rick Rothstein (MVP - VB)" wrote:

If he is using 1 and 0, you can use this to simplify the expression a
little...

..Range("D1") = -.Range("A1") And (-.Range("B1") Xor -.Range("C1"))

Note the minus signs in front of each Range expression for those ranges
to
the right of the equal sign.

Rick


"Bob Bridges" wrote in message
...
Yes, it does. Ok, you said it the way you meant it (not everyone
always
does): you want True only if A is True (or 1) and B is True (or 1) and
in
every other case you want the result to be False. You don't need a
program
for this - you can do it with Excel worksheet functions - but since you
specified a VBA program the statement would look something like this, I
guess:

With Myworksheet
For ir = 2 to BottomRow
.Range("D1") = .Range("A1") And (.Range("B1") Xor .Range("C1"))
Next ir
End With

That's if you're using True and False rather than 1 and 0. If you have
to
go with 1 and 0 it looks slightly more complicated but is really the
same:

With Myworksheet
For ir = 2 to BottomRow
.Range("D1") = .Range("A1")=1 And (.Range("B1")=1 Xor
.Range("C1")=1)
Next ir
End With

"A Xor B" means "if A is true or B is true but not both".

--- "DontKnow" wrote:
I hope this helps

--- "Bob Bridges" wrote:
Hmm... You mean the below is a truth table and you want the If
statement for
A, B and C that produces this result? But we're missing part of the
table.
Let me redraw it like this and you fill in the missing parts:

TRUE,TRUE,TRUE:? False
TRUE,TRUE,FALSE:TRUE
TRUE,FALSE,TRUE:TRUE
TRUE,FALSE,FALSE:? False
FALSE,TRUE,TRUE:FALSE
FALSE,TRUE,FALSE:FALSE
FALSE,FALSE,TRUE:? False
FALSE,FALSE,FALSE:? False

The If statement that produces the results you want depends on how
you
fill
in the missing parts.

--- "DontKnow" wrote:
if I want to set up a a sequencve ogf numbers in rows like this:

A B C Resultant
1 1 0 1
0 1 1 0
0 1 0 0
1 0 1 1

Where the resulatant output only provides a high (1) for numbers
in
columns
(A and C) or (A and B) and every other combination a low (0), how
would I
program something like this?? As shown above!!




  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default using the IF statement

All good mate thanks for your time,

Cheers

Thnaks for your help Bob and Rick!!

"Rick Rothstein (MVP - VB)" wrote:

If he is using 1 and 0, you can use this to simplify the expression a
little...

..Range("D1") = -.Range("A1") And (-.Range("B1") Xor -.Range("C1"))

Note the minus signs in front of each Range expression for those ranges to
the right of the equal sign.

Rick


"Bob Bridges" wrote in message
...
Yes, it does. Ok, you said it the way you meant it (not everyone always
does): you want True only if A is True (or 1) and B is True (or 1) and in
every other case you want the result to be False. You don't need a
program
for this - you can do it with Excel worksheet functions - but since you
specified a VBA program the statement would look something like this, I
guess:

With Myworksheet
For ir = 2 to BottomRow
.Range("D1") = .Range("A1") And (.Range("B1") Xor .Range("C1"))
Next ir
End With

That's if you're using True and False rather than 1 and 0. If you have to
go with 1 and 0 it looks slightly more complicated but is really the same:

With Myworksheet
For ir = 2 to BottomRow
.Range("D1") = .Range("A1")=1 And (.Range("B1")=1 Xor
.Range("C1")=1)
Next ir
End With

"A Xor B" means "if A is true or B is true but not both".

--- "DontKnow" wrote:
I hope this helps

--- "Bob Bridges" wrote:
Hmm... You mean the below is a truth table and you want the If
statement for
A, B and C that produces this result? But we're missing part of the
table.
Let me redraw it like this and you fill in the missing parts:

TRUE,TRUE,TRUE:? False
TRUE,TRUE,FALSE:TRUE
TRUE,FALSE,TRUE:TRUE
TRUE,FALSE,FALSE:? False
FALSE,TRUE,TRUE:FALSE
FALSE,TRUE,FALSE:FALSE
FALSE,FALSE,TRUE:? False
FALSE,FALSE,FALSE:? False

The If statement that produces the results you want depends on how you
fill
in the missing parts.

--- "DontKnow" wrote:
if I want to set up a a sequencve ogf numbers in rows like this:

A B C Resultant
1 1 0 1
0 1 1 0
0 1 0 0
1 0 1 1

Where the resulatant output only provides a high (1) for numbers in
columns
(A and C) or (A and B) and every other combination a low (0), how
would I
program something like this?? As shown above!!



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
IF statement inside a SUMIF statement.... or alternative method Sungibungi Excel Worksheet Functions 3 December 4th 09 06:22 PM
Reconcile Bank statement & Credit card statement & accounting data Bklynhyc Excel Worksheet Functions 0 October 7th 09 09:07 PM
Embedding an OR statement in an IF statement efficiently Chatnoir11 Excel Discussion (Misc queries) 4 February 2nd 09 08:12 PM
Can an If statement answer an If statement? M.A.Tyler Excel Discussion (Misc queries) 2 June 24th 07 04:14 AM
appending and IF statement to an existing IF statement spence Excel Worksheet Functions 1 February 28th 06 11:00 PM


All times are GMT +1. The time now is 04:31 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"