Nested if function using both "and" and "or"

ifu06416

Board Regular
Joined
Sep 5, 2011
Messages
56
Office Version
  1. 365
Hi there,

I have four 1 year long periods were a "special offer" was available and im trying to build an if function in B2 that identifies whether the offer was available on a random date (B1).

[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD][/TD]
[TD]A[/TD]
[TD]B[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]Random date[/TD]
[TD]Dec 04[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]Offer[/TD]
[TD]available[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]nov 03[/TD]
[TD]nov 04[/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]apr 06[/TD]
[TD]apr 07[/TD]
[/TR]
[TR]
[TD]6[/TD]
[TD]aug 09[/TD]
[TD]aug 10[/TD]
[/TR]
[TR]
[TD]7[/TD]
[TD]feb 12[/TD]
[TD]feb 13[/TD]
[/TR]
[TR]
[TD]8[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

I'm working with the formula below and it works for all other dates except those between Nov 04 and Apr 06 where the offer was not available. As can be seen in the example above the random date is Dec 04 and the formula in B2 calculated the offer as being available, incorrectly.

As I mentioned other dates eg between April 07 and August 09 work fine so I'm not sure what's wrong.

<a4,and(b1><a5),and(b1><a6),and(b1><a7),b1><a4,and(b1><a5),and(b1><a6),and(b1><a7),b1><a4,and(b1><a5),and(b1><a6),and(b1><a7),b1><a4,and(b1><a5),and(b1><a6),and(b1><a7),b1><a4,and(b1><a5),and(b1><a6),and(b1><a7),b1>IF(OR(B1<A4,AND(B1>B4, B1<A5),AND(B1>B5,B1<A6),AND(B1>B6,B1<A7),B1>B7),"not available","available")

Thank you in advance,

John Carlin.</a7),b1></a6),and(b1></a5),and(b1></a4,and(b1></a7),b1></a6),and(b1></a5),and(b1></a4,and(b1></a7),b1></a6),and(b1></a5),and(b1></a4,and(b1></a7),b1></a6),and(b1></a5),and(b1></a4,and(b1></a7),b1></a6),and(b1></a5),and(b1></a4,and(b1>
 
Last edited:
I'm surprised you're existing function works for you since it doesn't refer to B1. Try this:
Sheet2

*AB
Random date
Offerunavailable
**

<colgroup><col style="font-weight:bold; width:30px; "><col style="width:89px;"><col style="width:63px;"></colgroup><tbody>
[TD="bgcolor: #cacaca, align: center"]1[/TD]

[TD="align: right"]Dec-04[/TD]

[TD="bgcolor: #cacaca, align: center"]2[/TD]

[TD="bgcolor: #cacaca, align: center"]3[/TD]

[TD="bgcolor: #cacaca, align: center"]4[/TD]
[TD="align: right"]Nov-03[/TD]
[TD="align: right"]Nov-04[/TD]

[TD="bgcolor: #cacaca, align: center"]5[/TD]
[TD="align: right"]Apr-06[/TD]
[TD="align: right"]Apr-07[/TD]

[TD="bgcolor: #cacaca, align: center"]6[/TD]
[TD="align: right"]Aug-09[/TD]
[TD="align: right"]Aug-10[/TD]

[TD="bgcolor: #cacaca, align: center"]7[/TD]
[TD="align: right"]Feb-12[/TD]
[TD="align: right"]Feb-13[/TD]

</tbody>

Spreadsheet Formulas
CellFormula
B2=IF(SUMPRODUCT(--(A4:A7>=B1),--(B4:B7<=B1)),"","un")&"available"

<tbody>
</tbody>

<tbody>
</tbody>


Excel tables to the web >> Excel Jeanie HTML 4
 
Upvote 0
Any thoughts as to why every time i copy and paste the formula from excel to the forum it removes all the greater than and less than symbols? My 10 min editing window expired before i could correct it.
 
Upvote 0
Any thoughts as to why every time i copy and paste the formula from excel to the forum it removes all the greater than and less than symbols? My 10 min editing window expired before i could correct it.

It's a long standing issue. The workaround is to insert a space on either side of the greater than/less than symbols.
 
Upvote 0

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