How to combine an if and or function

saraapple

Board Regular
Joined
Feb 3, 2020
Messages
165
Office Version
  1. 2010
Platform
  1. Windows
I am trying to identify a full weekend worked in excel.
I have taken the obvious steps and identified the week days as numbers 1 to 7 but my formula is not working correctly to identify a full weekend.
The logic I am working from is shown below along with my formula which wrongly identifies the cells in red as TRUE:
Test data.xlsx
ABC
1Weekday StartWeekday EndWrong Formula
211TRUE
312TRUE
422FALSE
577TRUE
667TRUE
771TRUE
844FALSE
Sheet10
Cell Formulas
RangeFormula
C2:C8C2=IF(OR(A2:B2=1,A2:B2=7),TRUE, FALSE)


How would I change the formula to say "if A2 and B2 = 1 or A2 and B2 = 7 or A2 =7 and B2=1 return TRUE" - this would then identify full weekends worked I believe. I could do this myself though separate formulas but know there must be a simple way to complete this in one step - any help would be greatly appreciated.
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
How about
Excel Formula:
=AND(OR(A2=1,A2=7),OR(B2=1,B2=7))
 
Upvote 0
Solution
Thank you both, each work perfectly and I now have an understanding of where I was going wrong, so your help is most appreciated :)
 
Upvote 0
Glad we could help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,324
Members
452,635
Latest member
laura12345

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top