Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
for an If..Then statement you can do If "A1=B1" and "B1=C1" then
A1=C1. But is there a connecting word(AND) that can be done in the then part. such as......If (A1=B1) and (B1=C1) then (A1=C1) And (A1+3=D1) I know the syntacs aren't correct its an example to get the point across. Thanks |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
If A1=B1 and B1=C1 then
A1=C1 D1 = A1+3 End if A1 + 3 can't equal D1 unless you are testing if they do? -- Regards, Tom Ogilvy " wrote: for an If..Then statement you can do If "A1=B1" and "B1=C1" then A1=C1. But is there a connecting word(AND) that can be done in the then part. such as......If (A1=B1) and (B1=C1) then (A1=C1) And (A1+3=D1) I know the syntacs aren't correct its an example to get the point across. Thanks |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() " wrote: for an If..Then statement you can do If "A1=B1" and "B1=C1" then A1=C1. But is there a connecting word(AND) that can be done in the then part. such as......If (A1=B1) and (B1=C1) then (A1=C1) And (A1+3=D1) I know the syntacs aren't correct its an example to get the point across. Thanks |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Carlos,
I would suggest you try to make the syntax as realistic as possible. As Tom says, what you have written would clearly run into problems. Also, it is hard to tell (for me at least) whether you are talking about writing the code as a worksheet function or within a VBA module If you are working in a VBA module then you can perform multiple tasks based on the results of your comparison: If (A1 = B1) And (B1=C1) Then Do this Do this too And this ElseIf (A1 = B2) Do this And this Else Do this End If If you are working with worksheet formulas then no, because you have: =IF(AND(A1=B1,B1=C1), C2, C3) So the cell you type the formula in will result in the value of C2 if the condition is true, and C3 if the condition is false. A worksheet function doesnt (as far as Im aware) allow you to alter another cell directly, it simply gives the result of the formula you type in that cell. However, if you type =IF(AND(A1=B1,B1=C1),C2=5,C3=4)) Then if A1 = B1 and B1 = C1 then the true part of the result is looked at (C2=5) and if cell C2 does equal 5 the cell containing the formula will result in €śTrue€ť, whereas if cell C2 does not equal 5 then the cell containing the formula will result in €śFalse€ť. Also, if the original condition is False, then C3 = 4 is compared and the cell containing the formula will again result in either True or False. Therefore, there are numerous ways of getting the same result, and for most purposes you will not know whether conditions have been met or not (or which conditions at least). It would probably be better to keep all the conditional statements in the 1st part of the function. Anyway, I dont believe this is what you are trying to attempt, but I thought Id let you know, just so you can avoid this situation. " wrote: for an If..Then statement you can do If "A1=B1" and "B1=C1" then A1=C1. But is there a connecting word(AND) that can be done in the then part. such as......If (A1=B1) and (B1=C1) then (A1=C1) And (A1+3=D1) I know the syntacs aren't correct its an example to get the point across. Thanks |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
There is no reason to do an assignment of A1=C1 since by logic this is
already true. So I think we need a better explanation of what they are trying to accomplish. Peter Richardson On Jul 23, 3:22 pm, Tom Ogilvy wrote: If A1=B1 and B1=C1 then A1=C1 D1 = A1+3 End if A1 + 3 can't equal D1 unless you are testing if they do? -- Regards, Tom Ogilvy " wrote: for an If..Then statement you can do If "A1=B1" and "B1=C1" then A1=C1. But is there a connecting word(AND) that can be done in the then part. such as......If (A1=B1) and (B1=C1) then (A1=C1) And (A1+3=D1) I know the syntacs aren't correct its an example to get the point across. Thanks- Hide quoted text - - Show quoted text - |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
quick question | Excel Discussion (Misc queries) | |||
quick question | Excel Discussion (Misc queries) | |||
Quick question - quick answer about assigning shortcut keys | Excel Programming | |||
Very Quick Question | Excel Programming | |||
Very Quick Question | Excel Programming |