Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Condition Statement
Wonder if you can help me on this:
I'm writing more than 4 conditional statement in one loop: If =Bear Then If =Blue Then return If =Red Then return If <Bear Then If =Yellow Then return ..... The problem is that =Red condition keeps returning true even under <Bear i.e. 'Red' keeps showing up no matter what Why is that? |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Condition Statement
On Tue, 9 Dec 2003 00:46:05 -0800, Stel wrote:
Wonder if you can help me on this: I'm writing more than 4 conditional statement in one loop: If =Bear Then If =Blue Then return If =Red Then return If <Bear Then If =Yellow Then return .... The problem is that =Red condition keeps returning true even under <Bear i.e. 'Red' keeps showing up no matter what Why is that? Your problem is unclear. We need more info - what is equal to Red? To Bear? To Blue and Yellow? Can you perhaps post the actual code containing this chunk so we can see it in context? -- auric "underscore" "underscore" "at" hotmail "dot" com ***** There is no XXXXXXX place for censorship! |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Condition Statement
If cell(1,2)=bear Then
If cell(1,3)=Blue Then return ElseIf cell(1,3)=Red Then return ElseIf cell (1,2) <Bear Then If cell(1,3)=Yellow Then return ..... Can this explain better? Thank you very much! |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Condition Statement
Try to structure your argument in a logical way using
indentation. In this way you will find it easier to see what is wrong with your logic, and you'll be able to explain it to someone else as well: If Cells(1, 2) = Bear Then If Cells(1, 3) = Blue Then Return Else If Cells(1, 3) = Red Then Return End If End If Else If Cells(1, 2) < Bear Then If Cells(1, 3) = Yellow Then Return End If End If End If -----Original Message----- If cell(1,2)=bear Then If cell(1,3)=Blue Then return ElseIf cell(1,3)=Red Then return ElseIf cell (1,2) <Bear Then If cell(1,3)=Yellow Then return .... Can this explain better? Thank you very much! . |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Condition Statement
If cell(1,2)=bear Then
If cell(1,3)=Blue Then return ElseIf cell(1,3)=Red Then return ElseIf cell (1,2) <Bear Then If cell(1,3)=Yellow Then return End if You are trying to use a single line if statement but are using multiple lines. It either all has to be on one line or use a multiple line construct. In the above, the outer IF is multiline and the second level IF is single line. If cell(1,2)=bear Then If cell(1,3)=Blue Then return ElseIf cell(1,3)=Red Then return End if ElseIf cell (1,2) <Bear Then If cell(1,3)=Yellow Then return End if Is another alternative. or if cell(1,2)=bear and cell(1,3) = Blue or cell(1,3)=Red then return elseif cell(1,2)<bear and cell(1,3)=Yellow then return End if -- Regards, Tom Ogilvy "Stel" wrote in message ... If cell(1,2)=bear Then If cell(1,3)=Blue Then return ElseIf cell(1,3)=Red Then return ElseIf cell (1,2) <Bear Then If cell(1,3)=Yellow Then return ... Can this explain better? Thank you very much! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Multiple condition if statement | Excel Discussion (Misc queries) | |||
IF statement...And condition | Excel Discussion (Misc queries) | |||
3 logical condition if statement | Excel Worksheet Functions | |||
Blanks as a condition of a statement | New Users to Excel | |||
Condition Statement | Excel Discussion (Misc queries) |