D DCooper Member Licensed User Longtime User Feb 29, 2012 #1 I'm a newbie here and can't figure out how to make this work, and I have tried other variations to no avail... If TotalA = 0 To 0.304 Then Msgbox("2","Recommended Size") Else If TotalA = 0.305 to .500 Then Msgbox("3","Recommended Size") End If Thanks!
I'm a newbie here and can't figure out how to make this work, and I have tried other variations to no avail... If TotalA = 0 To 0.304 Then Msgbox("2","Recommended Size") Else If TotalA = 0.305 to .500 Then Msgbox("3","Recommended Size") End If Thanks!
JonPM Well-Known Member Licensed User Longtime User Feb 29, 2012 #2 Code: If TotalA >= 0 AND TotalA <= 0.304 Then Msgbox("2","Recommended Size") Else If TotalA >= 0.305 AND TotalA <= .500 Then Msgbox("3","Recommended Size") End If End If Upvote 0
Code: If TotalA >= 0 AND TotalA <= 0.304 Then Msgbox("2","Recommended Size") Else If TotalA >= 0.305 AND TotalA <= .500 Then Msgbox("3","Recommended Size") End If End If
timwil Active Member Licensed User Longtime User Feb 29, 2012 #3 How about this: Code: If (Total >=0) And (Total<= 0.304) Then .....do whatever Else If (Total >=0.305) And (Total<= 0.5) Then .....do whatever Else .....do whatever End If Upvote 0
How about this: Code: If (Total >=0) And (Total<= 0.304) Then .....do whatever Else If (Total >=0.305) And (Total<= 0.5) Then .....do whatever Else .....do whatever End If
klaus Expert Licensed User Longtime User Feb 29, 2012 #4 I would change it to this: Code: If (TotalA >= 0) And (TotalA <= 0.304) Then .....do whatever Else If (TotalA > 0.304) And (TotalA <= 0.5) Then .....do whatever Else .....do whatever End If Because if the value of Total = 0.3045 then it would have been in the Else section. Best regards Upvote 0
I would change it to this: Code: If (TotalA >= 0) And (TotalA <= 0.304) Then .....do whatever Else If (TotalA > 0.304) And (TotalA <= 0.5) Then .....do whatever Else .....do whatever End If Because if the value of Total = 0.3045 then it would have been in the Else section. Best regards
D DCooper Member Licensed User Longtime User Feb 29, 2012 #5 klaus said: I would change it to this: Code: If (TotalA >= 0) And (TotalA <= 0.304) Then .....do whatever Else If (TotalA > 0.304) And (TotalA <= 0.5) Then .....do whatever Else .....do whatever End If Because if the value of Total = 0.3045 then it would have been in the Else section. Best regards Click to expand... Thank you so much! It worked like a charm. Upvote 0
klaus said: I would change it to this: Code: If (TotalA >= 0) And (TotalA <= 0.304) Then .....do whatever Else If (TotalA > 0.304) And (TotalA <= 0.5) Then .....do whatever Else .....do whatever End If Because if the value of Total = 0.3045 then it would have been in the Else section. Best regards Click to expand... Thank you so much! It worked like a charm.
K kickaha Well-Known Member Licensed User Longtime User Feb 29, 2012 #6 why not remove TotalA > 0.304 from the Else If, as we know that it is if it got to that line. Code: If (TotalA >= 0) And (TotalA <= 0.304) Then .....do whatever Else If TotalA <= 0.5 Then .....do whatever Else .....do whatever End If Last edited: Feb 29, 2012 Upvote 0
why not remove TotalA > 0.304 from the Else If, as we know that it is if it got to that line. Code: If (TotalA >= 0) And (TotalA <= 0.304) Then .....do whatever Else If TotalA <= 0.5 Then .....do whatever Else .....do whatever End If
tremara1 Active Member Licensed User Longtime User Feb 29, 2012 #7 not covering the range I believe values in the first evaluation will be included in the second evaluation, it does not limit the overall evaluation to the range required. Upvote 0
not covering the range I believe values in the first evaluation will be included in the second evaluation, it does not limit the overall evaluation to the range required.
K kickaha Well-Known Member Licensed User Longtime User Mar 2, 2012 #8 tremara1 said: I believe values in the first evaluation will be included in the second evaluation, it does not limit the overall evaluation to the range required. Click to expand... No, if TotalA <= 0.304 then the second evaluation is never processed, so no need to check there if it is >0.304, as it must be (the clue is in the word ELSE). If you need confirmation, try running this code Code: TotalA = 0.2 If (TotalA >= 0) AND (TotalA <= 0.304) Then Log (">0 <=0.304") Else If TotalA <= 0.5 Then Log (">0.304 <=0.5") Else Log (">0.5") End If and alter TotalA, you will find only one of the logs can trigger, never two. Upvote 0
tremara1 said: I believe values in the first evaluation will be included in the second evaluation, it does not limit the overall evaluation to the range required. Click to expand... No, if TotalA <= 0.304 then the second evaluation is never processed, so no need to check there if it is >0.304, as it must be (the clue is in the word ELSE). If you need confirmation, try running this code Code: TotalA = 0.2 If (TotalA >= 0) AND (TotalA <= 0.304) Then Log (">0 <=0.304") Else If TotalA <= 0.5 Then Log (">0.304 <=0.5") Else Log (">0.5") End If and alter TotalA, you will find only one of the logs can trigger, never two.