IF OR AND

SJHA360

New Member
Joined
Aug 9, 2024
Messages
2
Office Version
  1. 365
Platform
  1. Windows
I have written pretty complex formulas in Excel for years, but this fairly simple IF statement has me stumped. I have written this every way I know, but it does not return the correct result. This is the original formula =IF(OR(E54>=5321,E54<=5327,E54>=5731,E54<=5738),"EVENT","REGULAR") What happens is the cell in E54=5321, so "Event" is returned correctly, however the cell in E53=5150, but still returns "Event", which is not correct. It should return "Regular"???

signed At Wits End
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
Hello, please test this:

Excel Formula:
=IF(OR(AND(E54>=5321,E54<=5327),AND(E54>=5731,E54<=5738)),"EVENT","REGULAR")
 
Upvote 1
Solution
hagia_sofia most likely has figured out the right answer here, which is admirable, lacking a description of what the formula is supposed to do.

When you string together several conditions in an OR, the result is TRUE if any of those conditions is TRUE. In the original formula, every number is either >=5321 or <=5327 so the result will always be TRUE for any number at all.
 
Upvote 0
Hello, please test this:

Excel Formula:
=IF(OR(AND(E54>=5321,E54<=5327),AND(E54>=5731,E54<=5738)),"EVENT","REGULAR")

It worked!!! Thank you so much, I thought I had already tried it this but evidently I did not. You are a life saver - meaning my own!
 
Last edited by a moderator:
Upvote 0
Please note:

When marking a reply as the solution, please mark the original post containing the solution, not your own post acknowledging that some other post is the solution.
I have updated this thread for you.
 
Upvote 0

Forum statistics

Threads
1,221,565
Messages
6,160,517
Members
451,655
Latest member
rugubara

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