Home |
Search |
Today's Posts |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
IF statement inside a SUMIF statement.... or alternative method | Excel Worksheet Functions | |||
Reconcile Bank statement & Credit card statement & accounting data | Excel Worksheet Functions | |||
Embedding an OR statement in an IF statement efficiently | Excel Discussion (Misc queries) | |||
Can an If statement answer an If statement? | Excel Discussion (Misc queries) | |||
appending and IF statement to an existing IF statement | Excel Worksheet Functions |