LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #7   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!!



 
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 09:47 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"