TEXTJOIN Function: Sort values in ascending order?

sureshr

New Member
Joined
Jan 7, 2017
Messages
3
I'm trying to use the TEXTJOIN function to list the number of products that appear in a package, and use the result as a Package ID. The Package ID's, however, should ignore the order in which the products are reported, and only assess the contents. Packages can contain as many as 6 and as few as 1 product, so I chose to use TEXTJOIN because it can ignore the blanks.

I'm struggling to find a way to identify different combinations by the same Package ID. It isn't feasible to manually assign Package ID's because in reality, there are far too many potential products and combinations. I've tried to incorporate "=RANK" to no avail, and couldn't find any other forums that helped me.

Below I've drawn out what I'm working with.


Cell B8 =TEXTJOIN(" ", True, B2:B7)


[TABLE="class: grid, width: 500, align: left"]
<tbody>[TR]
[TD][/TD]
[TD]A[/TD]
[TD]B[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD][/TD]
[TD]Product ID[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD][/TD]
[TD]4[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD][/TD]
[TD]3[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD][/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD][/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]6[/TD]
[TD][/TD]
[TD]-[/TD]
[/TR]
[TR]
[TD]7[/TD]
[TD][/TD]
[TD]-[/TD]
[/TR]
[TR]
[TD]8[/TD]
[TD]Package ID[/TD]
[TD]4 3 2 1[/TD]
[/TR]
</tbody>[/TABLE]















[TABLE="class: grid, width: 500, align: left"]
<tbody>[TR]
[TD][/TD]
[TD]A[/TD]
[TD]B[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD][/TD]
[TD]Product ID[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD][/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD][/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD][/TD]
[TD]3[/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD][/TD]
[TD]4[/TD]
[/TR]
[TR]
[TD]6[/TD]
[TD][/TD]
[TD]-[/TD]
[/TR]
[TR]
[TD]7[/TD]
[TD][/TD]
[TD]-[/TD]
[/TR]
[TR]
[TD]8[/TD]
[TD]Package ID[/TD]
[TD]1 2 3 4[/TD]
[/TR]
</tbody>[/TABLE]














Is there any other function I could incorporate into TEXTJOIN that would list the products in ascending order, so that these two Packages have the same ID?

I'd like to avoid macros on this one if at all possible, though I am open to using them.

Thank you very much for your help.
 
=concatenate(iferror(small(b2:b7,1),"")," ",iferror(small(b2:b7,2),"")," ",iferror(small(b2:b7,3),"")," ",iferror(small(b2:b7,4),"")," ",iferror(small(b2:b7,5),"")," ",iferror(small(b2:b7,6),""))
 
Upvote 0
Descending: In B8 control+shift+enter, not just enter:

=TEXTJOIN(" ",TRUE,IF(ISNUMBER($B$2:$B$7),LARGE($B$2:$B$7,ROW($B$2:$B$7)-ROW($B$2)+1),""))

For ascending, replace LARGE with SMALL.
 
Upvote 0

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