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).

AB
1Random dateDec 04
2Offeravailable
3
4nov 03nov 04
5apr 06apr 07
6aug 09aug 10
7feb 12feb 13
8

<tbody>
</tbody>

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:

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
I'm surprised you're existing function works for you since it doesn't refer to B1. Try this:
Sheet2

*AB
1Random dateDec-04
2Offerunavailable
3**
4Nov-03Nov-04
5Apr-06Apr-07
6Aug-09Aug-10
7Feb-12Feb-13

<colgroup><col style="font-weight:bold; width:30px; "><col style="width:89px;"><col style="width:63px;"></colgroup><tbody>
</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

Forum statistics

Threads
1,215,740
Messages
6,126,585
Members
449,319
Latest member
iaincmac

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