ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Problem with logical sentence (https://www.excelbanter.com/excel-programming/285606-problem-logical-sentence.html)

cecilia12345[_9_]

Problem with logical sentence
 
i have this conditional sentence
If Cells(NumFilas, 2).Value < "NAFF" Or Cells(NumFilas, 2).Value <
"NEQ" _
Or Cells(NumFilas, 2).Value < "IBR" Then

.....

end if

however, the conditions are ignored when the program is running...
why

--
Message posted from http://www.ExcelForum.com


Chip Pearson

Problem with logical sentence
 
Cecilia,

I think you want ANDs instead of ORs. With ANDs, one of the <
conditions will always be true, regardless of the value of
Cells(NumFilas,2).


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"cecilia12345" wrote
in message ...
i have this conditional sentence
If Cells(NumFilas, 2).Value < "NAFF" Or Cells(NumFilas,

2).Value <
"NEQ" _
Or Cells(NumFilas, 2).Value < "IBR" Then

....

end if

however, the conditions are ignored when the program is

running...
why?


---
Message posted from http://www.ExcelForum.com/




John Young

Problem with logical sentence
 
Have you tried bracketing the equations? Might work..

eg.

If ((Cells(NumFilas, 2).Value < "NAFF") Or (Cells(NumFilas, 2).Value <
"NEQ") _
Or (Cells(NumFilas, 2).Value < "IBR")) Then


John

"cecilia12345" wrote in message
...
i have this conditional sentence
If Cells(NumFilas, 2).Value < "NAFF" Or Cells(NumFilas, 2).Value <
"NEQ" _
Or Cells(NumFilas, 2).Value < "IBR" Then

....

end if

however, the conditions are ignored when the program is running...
why?


---
Message posted from http://www.ExcelForum.com/




BrianB

Problem with logical sentence
 
Because you should be using And <<grin.

--
Regards

Brian



"cecilia12345" wrote in message
...
i have this conditional sentence
If Cells(NumFilas, 2).Value < "NAFF" Or Cells(NumFilas, 2).Value <
"NEQ" _
Or Cells(NumFilas, 2).Value < "IBR" Then

....

end if

however, the conditions are ignored when the program is running...
why?


---
Message posted from http://www.ExcelForum.com/




Chip Pearson

Problem with logical sentence
 
I think you want ANDs instead of ORs. With ANDs, one of the <

I meant With ANDs not ORs.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Chip Pearson" wrote in message
...
Cecilia,

I think you want ANDs instead of ORs. With ANDs, one of the <
conditions will always be true, regardless of the value of
Cells(NumFilas,2).


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"cecilia12345" wrote
in message ...
i have this conditional sentence
If Cells(NumFilas, 2).Value < "NAFF" Or Cells(NumFilas,

2).Value <
"NEQ" _
Or Cells(NumFilas, 2).Value < "IBR" Then

....

end if

however, the conditions are ignored when the program is

running...
why?


---
Message posted from http://www.ExcelForum.com/






cecilia12345[_10_]

Problem with logical sentence
 
yes you were right.....


---
Message posted from http://www.ExcelForum.com/


No Name

Problem with logical sentence
 

-----Original Message-----
i have this conditional sentence
If Cells(NumFilas, 2).Value < "NAFF" Or Cells(NumFilas,

2).Value <
"NEQ" _
Or Cells(NumFilas, 2).Value < "IBR" Then

.....

end if

however, the conditions are ignored when the program is

running...
why?


---
Message posted from http://www.ExcelForum.com/

.


Try sometihng like this



MyCheck = Cells(NumFilas, 2).Value < "NAFF" Or Cells
(NumFilas, 2).Value < "NEQ" _ Or Cells(NumFilas, 2).Value
< "IBR"

If MyCheck = True then...
' ome
Else...
End If


Tom Ogilvy

Problem with logical sentence
 
At least two of the conditions will always be true. Change your OR to AND I
think.

--
Regards,
Tom Ogilvy

cecilia12345 wrote in message
...
i have this conditional sentence
If Cells(NumFilas, 2).Value < "NAFF" Or Cells(NumFilas, 2).Value <
"NEQ" _
Or Cells(NumFilas, 2).Value < "IBR" Then

....

end if

however, the conditions are ignored when the program is running...
why?


---
Message posted from http://www.ExcelForum.com/




Ryan Poth[_3_]

Problem with logical sentence
 
Chip,
Want to try again? <bg
Ryan

-----Original Message-----
I think you want ANDs instead of ORs. With ANDs, one

of the <

I meant With ANDs not ORs.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Chip Pearson" wrote in message
...
Cecilia,

I think you want ANDs instead of ORs. With ANDs, one

of the <
conditions will always be true, regardless of the value

of
Cells(NumFilas,2).


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"cecilia12345" <cecilia12345.yjxtb@excelforum-

nospam.com wrote
in message news:cecilia12345.yjxtb@excelforum-

nospam.com...
i have this conditional sentence
If Cells(NumFilas, 2).Value < "NAFF" Or Cells

(NumFilas,
2).Value <
"NEQ" _
Or Cells(NumFilas, 2).Value < "IBR" Then

....

end if

however, the conditions are ignored when the program

is
running...
why?


---
Message posted from http://www.ExcelForum.com/





.



All times are GMT +1. The time now is 09:20 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com