=FILTER to a set range of cells, avoiding #SPILL! error.

Marhier

Board Regular
Joined
Feb 21, 2017
Messages
128
Office Version
  1. 365
  2. 2021
Platform
  1. Windows
Good morning everyone.
I've got a small problem I'm hoping someone can help me solve.

I've created a dashboard which has a small table in the top right hand corner, and a table of similar size underneath it
Above these tables is a search box, where a user types a product code, or supplier name and it returns results based on a filter function.

So I understand the reason why I'm getting a #SPILL! error - because the table underneath is in the way of my FILTER results...
I'm wondering what I need to do/how to amend my formula so that it only returns results in the set range - in this case (V8:AA27).

My current formula is as follows:
Excel Formula:
=IF(LEN(V6)=0,"No Records Found",FILTER(Data[[MStockCode]:[MPriceUom]],ISNUMBER(SEARCH(V6,Data[MStockCode]))+ISNUMBER(SEARCH(V6,Data[Supplier Name]))+ISNUMBER(SEARCH(V6,Data[MPriceUom])),"No Records Found"))

Table looks as follows:

1675673777357.png



Thinking maybe FILTER would not be the right option for this?

All help is greatly appreciated.
Thank you.
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
You could wrap the FILTER function in a TAKE function - eg TAKE(FILTER(...),20) to return at most the first 20 results.
 
Upvote 0
Solution
You absolute HERO!
I was not aware of this TAKE function.

I can confirm this has solved my problem.

I amended my code to:
Excel Formula:
=IF(LEN(V6)=0,"No Records Found",TAKE(FILTER(Data[[MStockCode]:[MPriceUom]],ISNUMBER(SEARCH(V6,Data[MStockCode]))+ISNUMBER(SEARCH(V6,Data[Supplier Name]))+ISNUMBER(SEARCH(V6,Data[MPriceUom]))),20))
and it worked a treat.

Can't thank you enough.
 
Upvote 0

Forum statistics

Threads
1,223,754
Messages
6,174,313
Members
452,554
Latest member
Louis1225

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