textjoin with exact match

david763

New Member
Joined
Apr 3, 2012
Messages
42
Office Version
  1. 365
Platform
  1. Windows
Hi all, I am stuck on a problem which I think is simple - just can't get my head around it. I also think there is a much better, more obvious solution that I am also missing completely.
I am open to solution for either... :-)

I have two tabs:
1) is a master list of records
2) is a list of activities which link to one-or-more of the records

At present, the user manually enters the Records id(s) in the right most column on 2nd tab
I need to pick up and display the activities which match the record on the 1st tab (in red)

Problem:
I created this formula....
=TEXTJOIN(",",TRUE,IF(TEXT([@[R'#]],0)=activity[R'#],activity[A'#],""))
...which works perfectly, EXCEPT....

Instead of returning the results "101 102 106 109" against record "1", it returns ALL activities with a "1" in the Records number, ie it also includes records "104 107 111" as it also recognises 11, 12, 21 as they all contain a "1".

I need a way of only pulling through EXACT matches with the record number, OR an inspiring different methodology...

PS I could modify the layout of these tabs slightly, but no major changes, nor VBA if possible...


textjoin mr excel.jpg


Many thanks
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
Try this. The formula is not created by me. I get from another FB group.
Excel班級座號-1.xlsx
ABCDEF
1RecordsActivity
2R#resultA#R#
31101 102 106 1091011,2
42101 1031021
53103 1061032,3
64 10411
75110105
861101063,1
9711110712
108 10822,23
119 10921,22,1
1210 1105,6
1311104 1111117,11
1412107
1513 
1614 
1715 
1816 
1917 
2018 
2119 
2220 
2321109
2422108 109
2523108
工作表1
Cell Formulas
RangeFormula
B3:B25B3=TEXTJOIN(" ",,IFERROR(IF(FIND(","&A3&",",","&F$3:F$13&","),D$3:D$13),""))
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Upvote 0
Solution
I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)

IF you have dynamic array capability in your version, then a slight variation on the above would allow to to produce all those results with a formula in B3 only, without copying it down the column.

22 11 30.xlsm
ABCDEF
1RecordsActivity
2R#resultA#R#
31101 102 106 1091011,2
42101 1031021
53103 1061032,3
6410411
75110105
861101063,1
9711110712
10810822,23
11910921,22,1
12101105,6
1311104 1111117,11
1412107
1513
1614
1715
1816
1917
2018
2119
2220
2321109
2422108 109
2523108
Spill Results
Cell Formulas
RangeFormula
B3:B25B3=BYROW(A3:A25,LAMBDA(rw,TEXTJOIN(" ",,IFERROR(IF(FIND(","&rw&",",","&F$3:F$13&","),D$3:D$13),""))))
Dynamic array formulas.
 
Upvote 0
I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)

IF you have dynamic array capability in your version, then a slight variation on the above would allow to to produce all those results with a formula in B3 only, without copying it down the column.
Thank you for the solution Peter, and heads-up about account details - wasn't aware of that.

Kind regards
 
Upvote 0
You're welcome. :)

.. and thanks for updating your details. (y)
 
Upvote 0
What do you do it the numbers are not perfectly spaced 101 102 103, but instead 101,102103, etc?
Welcome to the MrExcel board!

I suggest that you start a new thread of your own. You can put a link to this one if you want. In your new thread I also suggest that you provide a small set of sample data and the expected results with XL2BB so that we can see your data, layout and what/where the results should be & we can also easily copy your sample data for testing.
 
Upvote 0

Forum statistics

Threads
1,223,230
Messages
6,170,883
Members
452,364
Latest member
springate

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