Attempting to Search one cells number values against an numbered ID list

jeremyweck

New Member
Joined
May 24, 2022
Messages
2
Office Version
  1. 365
Platform
  1. Windows
For starters this cannot be in VBA the intended users are not familiar enough with VBA to maintain the document. That being said im 90% of the way there. I have one cell with 2 or 3 number values between 1 and 35 and another cell returning all the values that are inside that cell. My only problem is that it is treating multiple digit numbers as individual integers. 1 and 32 is returning values for 1, 2, 3 and 32 and all i want is 1 and 32. I honestly think im right on the edge of it but i just cant seem to get my brain there.

My current formula

=TEXTJOIN(", ", TRUE, IF(COUNTIF(C2, "*"&$A$2:$A$35&"*"), $B$2:$B$35, ""))

1653427547438.png
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
Welcome to the Forum!

Here's one way:

ABCD
1
21A1,32A,gg
32B2,3,5,34B,C,F,END
43C6G
54E
65F
76G
87
98
109
1110
1211
1312
1413
1514
1615
1716
1817
1918
2019
2120
2221
2322
2423
2524
2625
2726
2827
2928
3029
3130
3231
3332gg
3433
3534END
Sheet1
Cell Formulas
RangeFormula
D2:D4D2=TEXTJOIN(",",,INDEX(B$2:B$35,FILTERXML("<x><y>"&SUBSTITUTE(C2,",","</y><y>")&"</y></x>","//y")))

You've shown

C2: 1,'32

If quote marks are the only potential superfluous characters (?) you could add a simple SUBSTITUTE within this formula to strip them out.
 
Upvote 0
Thank you. That does appear to get the job done. This is the first i have worked with FilterXML do you happen to know if its compatible with older excel versions and could i use an index, match variation to achieve the same result?
 
Upvote 0
The Filterxml function is available from xl 2013, however Textjoin is only available from xl 2019
 
Upvote 0

Forum statistics

Threads
1,224,815
Messages
6,181,135
Members
453,021
Latest member
Justyna P

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