Solving this problem with dynamic array formula

tm23

New Member
Joined
Aug 30, 2020
Messages
7
Office Version
  1. 365
Platform
  1. Windows
Dear all,
How would you solve the concatenation of the column comment, without vba and using only one dynamic array formula in E2
So far, I have something like this, but this is not dynamic, even if you add D2#
=JOINTEXT("/",TRUE,IF($A$2:$A$5=D2,$B$2:$B$5,""))
Thanks for any idea.

IDCommentIDComment concatenated
15​
AA
12​
CC/DD
16​
BB
16​
BB
12​
CC
12​
DD
 

Attachments

  • 1598773743801.png
    1598773743801.png
    2.6 KB · Views: 10
I am falling in love with LET !

I cleaned up the formula, used the same syntax as xlookup, and added a couple more argument to manage the "if_not_found".

If you see ways to simplify it further or if you identify cases where it will not work, please let me know :-)

simplified problem3.xlsm
ABCDEFGHIJKLMNO
1IDCommentIDThese solutions work, but no spillsSolution with spillsDummy data for col. A and BDummy data for the col. D
215AA12CC|DDCC/DDCC/DDCC|DD15AA12
316BB15AAAAAAAA16BB15
412CC99#CALC! #CALC!No result12CC99
512DD 12DD
Feuil1
Cell Formulas
RangeFormula
A2:B5A2=FILTER(L2:L5,L2:L5>0)
D2:D4D2=FILTER(O2:O4,O2:O4>0)
F2:F4F2=TEXTJOIN("|",TRUE,FILTER($B$2#,$A$2#=D2))
G2:G4G2=TEXTJOIN("/",TRUE,IF($A$2#=D2,$B$2#,""))
J2:J4J2=LET( lookup_values,D2#, lookup_array,A2#, return_array_to_concat,B2#, col_range_to_concat,B:B, separator_row,"\", separator_col,"|", if_not_found,"No result", array_before_split,IFERROR(INDEX(col_range_to_concat,IF((lookup_values=TRANSPOSE(lookup_array)),TRANSPOSE(ROW(return_array_to_concat)),"")),separator_col), CountCol_array_before_split,COLUMNS(array_before_split), array_to_split,TEXTJOIN(IF(ROUNDDOWN(SEQUENCE(CountCol_array_before_split,1,1,1/(IF(CountCol_array_before_split=1,1,CountCol_array_before_split-1))),0)>1,separator_row,separator_col),0,array_before_split), pre_final_result,SUBSTITUTE(TRANSPOSE(INDEX((FILTERXML("<b><a>"&SUBSTITUTE(TEXTJOIN(separator_row,,array_to_split),separator_row,"</a><a>")&"</a></b>","//a")),SEQUENCE(ROWS(array_to_split),LEN(INDEX(array_to_split,1,1))-LEN(SUBSTITUTE(INDEX(array_to_split,1,1),separator_row,))+1))),separator_col&separator_col,""), IF(pre_final_result=separator_col,if_not_found,pre_final_result))
H2:H5H2=IF(D2="","",TEXTJOIN("/",1,FILTER(INDEX($B$2#,0,1),INDEX($A$2#,0,1)=D2)))
Dynamic array formulas.
 
Upvote 0

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
@tm23
I am falling in love with LET !

I cleaned up the formula, used the same syntax as xlookup, and added a couple more argument to manage the "if_not_found".

If you see ways to simplify it further or if you identify cases where it will not work, please let me know :)

simplified problem3.xlsm
ABCDEFGHIJKLMNO
1IDCommentIDThese solutions work, but no spillsSolution with spillsDummy data for col. A and BDummy data for the col. D
215AA12CC|DDCC/DDCC/DDCC|DD15AA12
316BB15AAAAAAAA16BB15
412CC99#CALC! #CALC!No result12CC99
512DD 12DD
Feuil1
Cell Formulas
RangeFormula
A2:B5A2=FILTER(L2:L5,L2:L5>0)
D2:D4D2=FILTER(O2:O4,O2:O4>0)
F2:F4F2=TEXTJOIN("|",TRUE,FILTER($B$2#,$A$2#=D2))
G2:G4G2=TEXTJOIN("/",TRUE,IF($A$2#=D2,$B$2#,""))
J2:J4J2=LET( lookup_values,D2#, lookup_array,A2#, return_array_to_concat,B2#, col_range_to_concat,B:B, separator_row,"\", separator_col,"|", if_not_found,"No result", array_before_split,IFERROR(INDEX(col_range_to_concat,IF((lookup_values=TRANSPOSE(lookup_array)),TRANSPOSE(ROW(return_array_to_concat)),"")),separator_col), CountCol_array_before_split,COLUMNS(array_before_split), array_to_split,TEXTJOIN(IF(ROUNDDOWN(SEQUENCE(CountCol_array_before_split,1,1,1/(IF(CountCol_array_before_split=1,1,CountCol_array_before_split-1))),0)>1,separator_row,separator_col),0,array_before_split), pre_final_result,SUBSTITUTE(TRANSPOSE(INDEX((FILTERXML("<b><a>"&SUBSTITUTE(TEXTJOIN(separator_row,,array_to_split),separator_row,"</a><a>")&"</a></b>","//a")),SEQUENCE(ROWS(array_to_split),LEN(INDEX(array_to_split,1,1))-LEN(SUBSTITUTE(INDEX(array_to_split,1,1),separator_row,))+1))),separator_col&separator_col,""), IF(pre_final_result=separator_col,if_not_found,pre_final_result))
H2:H5H2=IF(D2="","",TEXTJOIN("/",1,FILTER(INDEX($B$2#,0,1),INDEX($A$2#,0,1)=D2)))
Dynamic array formulas.

I would like to discuss this current formula and inquire as to whether there is a better way to deal with a longer list of values. The max lookup row limit seems to be around 76
 
Upvote 0
Hi & welcome to MrExcel
You would be better of starting a thread of your own & explaining exactly what you are trying to do, along with posting some sample data. There are some newer functions that would make things easier.
 
Upvote 0
@tm23


I would like to discuss this current formula and inquire as to whether there is a better way to deal with a longer list of values. The max lookup row limit seems to be around 76
It is 2 years later but if you still need a simple solution, you can use the MAP function instead.

=MAP(D2#,LAMBDA(num,TEXTJOIN("/",TRUE,IF($A$2:$A$5=num,$B$2:$B$5,""))))
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,182
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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