Extract multiple numbers from cell based on a criteria list

raptor5618

New Member
Joined
Oct 5, 2021
Messages
1
Office Version
  1. 365
Platform
  1. Windows
Item 110215 1601 4510 4542 6546 7271
Item 210215 10556 1601 4510 4542 6546 7271

in the cells with multiple numbers I need to know based on the item I need to know if the item has a number that matches a criteria list. I would be fine with changing the font of those numbers that match the criteria or extracting them to another cell. Currently I extract text to columns and then vlookup each column. (for some items there are 10 or 20 numbers.) Followed by a textjoin over the range of lookups It works but is a bit clunky and removing the #N/A's I only succeeded by putting a space so the result from text join has to be edited so that all the multiple spaces are removed. I tried find and replace which really was not ideal either but found an item but would change the criteria of the whole cell so bolding just the matching criteria didn't work either. I am looking for a method of pulling every number that matches the list of criteria and putting them into another cell. without having to extract and vlookup and textjoin. Thanks.
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.

Eric W

MrExcel MVP
Joined
Aug 18, 2015
Messages
11,686
Welcome to the MrExcel forum!

How about:

Book2
ABCDEF
1MatchesList
2Item 110215 1601 4510 4542 6546 727110215 654610215
3Item 210215 10556 1601 4510 4542 6546 727110215 6546 105566546
410556
5999
68888
Sheet7
Cell Formulas
RangeFormula
C2:C3C2=TEXTJOIN(" ",1,IF(ISNUMBER(FIND(" "&$F$2:$F$6&" "," "&B2&" ")),$F$2:$F$6,""))
 

JamesCanale

Active Member
Joined
Jan 13, 2021
Messages
393
Office Version
  1. 365
Platform
  1. Windows
  2. MacOS
How about:
MrExcelPlayground4.xlsx
ABCDEF
27Item 110215 1601 4510 4542 6546 7271451010215
28Item 210215 10556 1601 4510 4542 6546 727145101021510556
29
30
31List
324510
3310215
3410556
Sheet11
Cell Formulas
RangeFormula
D27:F28D27=IFERROR(MID(B27,TRANSPOSE(SEARCH($B$32:$B$34,B27)),SEARCH(" ",B27,TRANSPOSE(SEARCH($B$32:$B$34,B27))+1)-TRANSPOSE(SEARCH($B$32:$B$34,B27))),"")
Dynamic array formulas.
 

Eric W

MrExcel MVP
Joined
Aug 18, 2015
Messages
11,686
James, your version will match partial numbers too. Change B32 to 510 to see. Also, you can shorten it a bit by just doing the TRANSPOSE at the end:

Excel Formula:
=IFERROR(TRANSPOSE(MID(B27,SEARCH($B$32:$B$34,B27),SEARCH(" ",B27,SEARCH($B$32:$B$34,B27)+1)-SEARCH($B$32:$B$34,B27))),"")
 

JamesCanale

Active Member
Joined
Jan 13, 2021
Messages
393
Office Version
  1. 365
Platform
  1. Windows
  2. MacOS
yes... Very clever adding the space on each on of Col B.
 

Forum statistics

Threads
1,148,334
Messages
5,746,154
Members
423,994
Latest member
blzxatly

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
Top