Return all rows matching multiple criteria

agutt

New Member
Joined
Oct 3, 2023
Messages
5
Office Version
  1. 365
Hey all. Don't wish to filter. I guess Index/Match, but man that gets complicated fast, and I couldn't find examples that used both strings and values as I need here.

As an example, I set up this table (sorry, couldn't get xl2bb to work):

1696354640013.png


Off to the right, I just manually pasted over the correct values for my selection (contains ham and mayo is <$9), but of course I'm seeking a formula to automate this. Multiple criteria, some text some integer.

TIA
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
You need to extract the add-in from the file & copy that to the add-in folder.
 
Upvote 0
Since you are using 365, why not use the new FILTER function (which is different from Filters/Advanced Filters)?
It is very easy using this (see: FILTER Function)

So here is what your example results would look like:
1696355676278.png


And all you have to do is out the following formula in cell I4, and everything spills over to the other columns and rows:
Excel Formula:
=FILTER(A2:E11,(A2:A11="Ham")*(D2:D11="Mayo")*(E2:E11<9))
You can even replace the hard-coded references of "Ham", "Mayo", and 9 with cell references, if you like.
 
Upvote 0
Solution
Interesting, I didn't know this function existed. I have run into a problem however... the example I drew up here is just an example. My actual data/range is larger. Just tried your formula, inserting the correct fields (table range, (condition)*(condition)*(condition)) and I'm getting SPILL! error... not one I'm used to encountering. Any ideas?
 
Upvote 0
With these new functions that automatically "spill" over into other columns and rows in order to return all the matching data, you need to be sure to leave enough room!

So, if you are placing the formula in cell I4, and it is returning 10 rows of data, if you have something in cell I9, you are going to get an error because you did not leave enough room for it to return 10 rows! My guess if that you have not left enough room.
 
Upvote 0
You are welcome. Glad I was able to help!
I love that new FILTER function myself! It is pretty cool...
 
Upvote 0

Forum statistics

Threads
1,223,897
Messages
6,175,270
Members
452,628
Latest member
dd2

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