AND Function in Dynamic List

drewberts

Board Regular
Joined
Sep 5, 2013
Messages
177
Office Version
  1. 365
Platform
  1. Windows
I'm trying to create 2 x dynamic lists to display items based on no of days to an expiry date. First list shows items which have no. of days to expiry of 0 or less using the following array formula (this works fine):-

{=IFERROR(INDEX($B$1:$B$100,SMALL(IF(R$E$2:$E$100<=0,ROW($E$2:$E$100)),ROW(1:1))),"")}

The 2nd list is to show items which have less than 30 days to go (excluding expired items) - so the criteria is <=30 AND >0 so I've used an AND function as below and I'm just getting the first item in the list - I'm guessing my syntax is wrong somewhere even though its not returning an error.

{=IFERROR(INDEX($B$1:$B$100,SMALL(IF(AND($E$2:$E$100<=30,$E$2:$E$100>0),ROW($E$2:$E$100)),ROW(1:1))),"")}

Col B = Item Name
Col E = Days to Expiry

Can anyone see where I'm going wrong? (Excel 365)
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
Excel 365

I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)

How about
Excel Formula:
=filter(B1:B100,(E2:E100<=30)*(E2:E100>0))
 
Upvote 0
AND will only return one result - TRUE if every row matches the criteria, FALSE otherwise - not an array of results, one for each row. You need to multiply the arrays instead:

Excel Formula:
=IFERROR(INDEX($B$1:$B$100,SMALL(IF(($E$2:$E$100<=30)*($E$2:$E$100>0)),ROW($E$2:$E$100)),ROW(1:1))),"")
 
Upvote 0
I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)

How about
Excel Formula:
=filter(B1:B100,(E2:E100<=30)*(E2:E100>0))
Thanks Fluff - details updated

Your suggestion returns a #VALUE error
 
Upvote 0
AND will only return one result - TRUE if every row matches the criteria, FALSE otherwise - not an array of results, one for each row. You need to multiply the arrays instead:

Excel Formula:
=IFERROR(INDEX($B$1:$B$100,SMALL(IF(($E$2:$E$100<=30)*($E$2:$E$100>0)),ROW($E$2:$E$100)),ROW(1:1))),"")
Thanks Rory - your suggestion gives me an excel error (problem with the formula)
 
Upvote 0
The ranges are mismatched, try
Excel Formula:
=FILTER(B2:B100,(E2:E100<=30)*(E2:E100>0))
 
Upvote 0
The ranges are mismatched, try
Excel Formula:
=FILTER(B2:B100,(E2:E100<=30)*(E2:E100>0))
Thanks Fluff - thought of that but I get a #CALC error with that.
The mismatched arrays work with the single criteria INDEX
 
Upvote 0
Glad we could help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,214,650
Messages
6,120,736
Members
448,988
Latest member
BB_Unlv

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