Multiple IF OR AND in one formula

armandoferrari

New Member
Joined
May 14, 2019
Messages
3
Hello,


I am trying to write a formula that checks whether or not an order was placed after/before hours in different time zones across three states. Would really appreciate if someone could help.


I've tried nesting a few IFs with OR and AND but can't seem to figure out the correct combination/order. This is the base formula i'm working off of; =IF(AB2>=(--"8:00 PM"),"Yes","No")


The 'time' (using Eastern) is in cell AB2
The 'state' (OR, KY, or IN) is in cell X2


I am essentially trying to write: tell me Yes if an order is placed after 8pm or before 9am in KY and IN, after 11pm or before 12pm in OR, or tell me No.


Another way of looking at it with the cells; IF (AB2 is >=8pm or <9am, and X2 is either "IN" or "KY") or (AB2 is >=11pm or <12pm and X2 is "OR") give me the result Yes, if false give me the result No.



Not sure if this could even be done.


Thanks,
Armando
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
Try

=IF(OR(AND(OR(X2="KY",X2="IN"),OR(AB2>=TIMEVALUE("20:00"),AB2<=TIMEVALUE("21:00"))),AND(X2="OR",AB2<=TIMEVALUE("12:00"))),"Yes","No")

where X2 is two letter state codes
and AB2 is a time from 00:00 to 23:59
 
Last edited:
Upvote 0
The syntax is correct however it's not pulling the results accurately.

The cells where switched as well. State is X2 and Time is AB2.
 
Upvote 0
I've updated the formula in post #2

If this doesn't work post some sample data
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,240
Messages
6,170,951
Members
452,368
Latest member
jayp2104

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