![]() |
Boolean Question
Greetings,
I am sure missing something but just can't see it. When I run the code If ((NewProd < "") And (NewProd < Prod)) Or (DRun <= 30) Then More code here End If and NewProd = "One", Prod = "One" and DRun = 5, the If passes to the More code here. I had previously used: If ((NewProd < "") And (NewProd < Prod)) Or DRun <= 30 Then If (NewProd < "" And NewProd < Prod) Or (DRun <= 30) Then with the same results. To get this to work I ended up using: If NewProd < Prod Then If (NewProd < "") Or (DRun <= 30) Then Would someone explain the error of my ways? Thanks in advance for your help. Ray |
Boolean Question
Of course it does.
You DRun is 5, so it's less than or equal to 30. The If condition evaluates to True. "Ray Batig" wrote in message ink.net... Greetings, I am sure missing something but just can't see it. When I run the code If ((NewProd < "") And (NewProd < Prod)) Or (DRun <= 30) Then More code here End If and NewProd = "One", Prod = "One" and DRun = 5, the If passes to the More code here. I had previously used: If ((NewProd < "") And (NewProd < Prod)) Or DRun <= 30 Then If (NewProd < "" And NewProd < Prod) Or (DRun <= 30) Then with the same results. To get this to work I ended up using: If NewProd < Prod Then If (NewProd < "") Or (DRun <= 30) Then Would someone explain the error of my ways? Thanks in advance for your help. Ray |
Boolean Question
If I understand your question then you were close on your second attempt. It
is a brackets thing. (Boolean is not too easy to follow) If (NewProd < "") And (NewProd < Prod Or DRun <= 30) Then In the above NewProd < "" must be true or the whole thing is false. Either NewProd < Prod Or DRun <= 30 must be true, otherwise the whole thing is false... Give it a try. I haven't but I think that is what you want... HTH "Ray Batig" wrote: Greetings, I am sure missing something but just can't see it. When I run the code If ((NewProd < "") And (NewProd < Prod)) Or (DRun <= 30) Then More code here End If and NewProd = "One", Prod = "One" and DRun = 5, the If passes to the More code here. I had previously used: If ((NewProd < "") And (NewProd < Prod)) Or DRun <= 30 Then If (NewProd < "" And NewProd < Prod) Or (DRun <= 30) Then with the same results. To get this to work I ended up using: If NewProd < Prod Then If (NewProd < "") Or (DRun <= 30) Then Would someone explain the error of my ways? Thanks in advance for your help. Ray |
All times are GMT +1. The time now is 09:02 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com