Filter, isnumber, search a range of criteria

shakethingsup

Board Regular
Joined
May 21, 2017
Messages
64
Office Version
  1. 365
Platform
  1. Windows
Hi, I'm good with filter, isnumber, search when there is one criteria to search for.

Now I have a range instead of one piece of text to search for.

My original formula for one criteria was in cell D1 with my search criteria in C1:
=Filter(A:A,isnumber(search(C1,B:B)))

Now I have search criteria in C1 and C2:
- I saw a sumproduct formula but that seems to only search one cell at a time
=SUMPRODUCT(--ISNUMBER(SEARCH(C1:C2,B1)))>0

How do I combine all of this together? Filter + isnumber + search + range of criteria to search? I'm trying to search the forums but am missing something.

Thank you in advance,
Mayank
 
After reviewing the BYRow function, which retrieves all rows and takes a lambda parameter named 'rw', I understand that the 'rw' parameter is used to represent the items that result from the ByRow operation.

Is my understanding correct?
Yes, but there is nothing special about using "rw" specifically. You could use whatever 'variable' name you want there.

I'm curious to know how you learned these amazing formulas.
Mostly by studying threads in this forum and plenty of trial & error.
 
  • Like
Reactions: Biz
Upvote 0

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
Would something like one of these be any use to you? Column E searches for the text strings, column G searches for whole words only.
The column C range of things to look for can be as large as you like.

23 05 09.xlsm
ABCDEFG
1DataTextcat
2Data 1dogdogData 1Data 1
3Data 2scatterratData 2Data 5
4Data 3pigData 5
5Data 4horseData 6
6Data 5grey rat
7Data 6rather not
Filter multiple values
Cell Formulas
RangeFormula
E2:E5E2=FILTER(A2:A7,BYROW(B2:B7,LAMBDA(rw,COUNT(SEARCH(C1:C3,rw)))))
G2:G3G2=FILTER(A2:A7,BYROW(B2:B7,LAMBDA(rw,COUNT(SEARCH(" "&C1:C3&" "," "&rw&" ")))))
Dynamic array formulas.

Hi Peter,
This is amazing. Is there a way to use this but also excude words?
 
Upvote 0
Is there a way to use this ...
Welcome to the MrExcel board!
Which? There were two different solutions suggested in that post you have quoted.

... but also excude words?
Exclude words?

It Would be helpful if you provided a small but representative set of dummy sample data and the expected results with XL2BB and then explain just what you are trying to do with reference to the sample data.
 
Upvote 0
Welcome to the MrExcel board!
Which? There were two different solutions suggested in that post you have quoted.


Exclude words?

It Would be helpful if you provided a small but representative set of dummy sample data and the expected results with XL2BB and then explain just what you are trying to do with reference to the sample data.
Hi,
Sorry I was a bit vague. It's the Lambda function. Unfortunately I can't install XL2BB so I hope the screenshot is ok. I'm trying to sort stock in to groups so in 1 instance I would want to find Exam tables and Exam desks but exclude Premium, Skid and Trolley but in another search for just Exam Trolleys etc.
 

Attachments

  • Capture.JPG
    Capture.JPG
    43.7 KB · Views: 6
Upvote 0
It's the Lambda function.
Both solutions in the marked post use the LAMBDA function but the results are different depending on what you are trying to do. Please read the text above my mini sheet in the marked solution post & clarify which of those search methods you require.
The formula that you have shown in your image suggests that if column B happened to have an entry "Exam Tablets for sale" then you would want that entry included in your results. Is that correct?
 
Upvote 0
I was using the string search version which gave me my base data searching for Exam Desk and Exam table and I'm looking to remove results to get a refined list. For instance, I would want to remove anything with Skid, Premium or trolley. I'm already getting the results I need using isnumber & iserror searches but the formulas are very long and messy and your way is a lot neater and easier to amend.
 
Upvote 0
I was using the string search version
OK, see if this is it then.

Andrew123456789.xlsm
ABCDEFGH
1A1Exam DeskInclude these .. .. but Exclude theseA1Exam Desk
2A2Exam Desk Skid BaseExam DeskSkidA3Exam Table
3A3Exam TableExam TablePremiumA8Exam Tablets
4A4Premium Exam TableTrolleyA9Hexam Desk
5A5Premium Exam DeskA10Non-Exam Table
6A6Exam Desk and Trolley
7A7Exam Desk Trolley
8A8Exam Tablets
9A9Hexam Desk
10A10Non-Exam Table
11A11Ordinary Chair
Sheet1
Cell Formulas
RangeFormula
G1:H5G1=FILTER(A1:B11,BYROW(B1:B11,LAMBDA(rw,COUNT(SEARCH($D$2:$D$3,rw))*(COUNT(SEARCH($E$2:$E$4,rw))=0))))
Dynamic array formulas.
 
Upvote 1
OK, see if this is it then.

Andrew123456789.xlsm
ABCDEFGH
1A1Exam DeskInclude these .. .. but Exclude theseA1Exam Desk
2A2Exam Desk Skid BaseExam DeskSkidA3Exam Table
3A3Exam TableExam TablePremiumA8Exam Tablets
4A4Premium Exam TableTrolleyA9Hexam Desk
5A5Premium Exam DeskA10Non-Exam Table
6A6Exam Desk and Trolley
7A7Exam Desk Trolley
8A8Exam Tablets
9A9Hexam Desk
10A10Non-Exam Table
11A11Ordinary Chair
Sheet1
Cell Formulas
RangeFormula
G1:H5G1=FILTER(A1:B11,BYROW(B1:B11,LAMBDA(rw,COUNT(SEARCH($D$2:$D$3,rw))*(COUNT(SEARCH($E$2:$E$4,rw))=0))))
Dynamic array formulas.
That works perfectly. You are a legend. Thank you so much. This will make amendments so much easier and tidier.
 
Upvote 0

Forum statistics

Threads
1,223,723
Messages
6,174,122
Members
452,545
Latest member
boybenqn

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