Your parentheses are not in the correct place. You completely close out the AND formula, so the OR part of your formula is actually in argument 2 (what to return if TRUE), not argument 1 (part of what you are checking).
Please explain ALL the conditions that you want to check, in plain English (so we can accurately understand how you would like them grouped).
(I could "guess", but I do not like to assume I know what your intention is.)
The formula that TriAxisZero sent =IF(OR(AND($F$2>=A4,$C$2<=B4),AND($F$2>=A5,$C$2<=B5)),"YES","NO")
Ultimately I am trying include conditions that not only include A4, B4 and A5, B5 as in the formula above
But also include all the way up to A300, B300
I know that will make for a very long formula but I do not know any other way to accomplish it.
I doubt that is going to be possible (at least in the way that you have proposed). There are limits to the length of formulas and how many conditions you can add.
I think you would be better off to post a sample of your data, and explain (in plain English), exactly what you want this formula to do/check.
There may be more efficient ways to do what you want, if we can see what you are working with and completely understand what you are trying to accomplish.
I have the following ranges of IP addresses that I will search against
(For example purposes I am just going to provide the first 50 ranges)
Note that these ranges are in columns A and B
The remainder of my message is below these ranges:
F3 through F15 are IP addresses that I want to search for to see if they fall in any of the 50 ranges that I listed above
If found, the formulas that will be in G3 through G15 will return YES. If not found, the formulas will return NO.
Below are the addresses that are in F3 through F15
I might consider converting them to numbers (maybe behind the scenes in another sheet, to make the calculations easy).
There are four parts to each address. Is is true that each part can never be more than 3 characters long?
If so, then I would conver them to numeric entries like:
Here is a little Custom Function that I just whipped up that will convert an IP address to a number:
Function IPtoNum(ip As String) As Double
Dim arr() As String
Dim i As Long
Dim total As Double
arr = Split(ip, ".")
For i = LBound(arr) To UBound(arr)
Select Case i
total = total + (arr(0) * 1000000000)
total = total + (arr(1) * 1000000)
total = total + (arr(2) * 1000)
total = total + arr(3)
IPtoNum = total
Add this to a standard VBA module in your workbook.
Then you can use it like any other Excel function.
So, if you have an IP address in cell A1, this formula will return the numeric value of it: =IPtoNum(A1)
Great, now all you have to do is to write a COUNTIFS formula that counts how many times a value falls between the start and end values for each IP range.
If it is greater than 0, then you have a "Yes", otherwise you have a "No".
So, if your convertred starting ranges were in column G, and your converted ending ranges were in column H, and the converted value you are looking up is in cell K1, then the formula would look like: