Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

"OR" in Excel formula 1

Status
Not open for further replies.

sqleptical

Programmer
Sep 26, 2001
112
US
I'm trying to use a formula to compare/flag the current time (B1) to the in/out time entered on Sheet1 (between Sheet1!B3 & Sheet1!c3 OR between Sheet1!d3 & Sheet1!e3). The following is what I came up with, but does not work. Any ideas?

=IF(OR(B1>=Sheet1!B3,B1 <= Sheet1!C3,B1>=Sheet1!D3,B1 <= Sheet1!E3 ),1,0)
 



So here's what your logic is
[tt]
IF B1 >= Sheet1!B3 OR
B1 <= Sheet1!C3 OR
B1 >= Sheet1!D3 OR
B1 <= Sheet1!E3 Then
1
Else
0
[/tt]
Is that the correct LOGIC?

Then what VALUES are in
[tt]
B1
Sheet1!B3
Sheet1!C3
Sheet1!D3
Sheet1!E3
[/tt]

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 





I'm guessing that your LOGIC is incorrect.

Please explain what you are trying to do, and don't say that you want to OR 4 expressions.

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Thanks for the response! The logic should be;

IF B1 >= Sheet1!B3 AND
B1 <= Sheet1!C3 OR
B1 >= Sheet1!D3 AND
B1 <= Sheet1!E3 Then
1
Else
0
 


Well AND works the samy way as OR. Have you tried working it?
[tt]
IF(OR(AND(B1>=Sheet1!B3,B1<=Sheet1!C3),AND(B1>=Sheet1!D3,B1<=Sheet1!E3)),1,0)
[/tt]
I would give those 4 cells on Sheet1 Range Names, like
[tt]
Start1
End1
Start2
End2
[/tt]
then the formula becomes a bot more understandable...
[tt]
[tt]
IF(OR(AND(B1>=Start1,B1<=End1),AND(B1>=Start2,B1<=End2)),
1,0)
[/tt]




Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
That worked Skip...Thanks!

This is at least the second time you have helped me!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top