Concatenate Unique Values but remove the "/" where the valuue is unique

VBA learner ITG

Active Member
Joined
Apr 18, 2017
Messages
272
Office Version
  1. 365
Platform
  1. Windows
  2. MacOS
Hi all,

I need your guidance if possible on how to amend the below array formula?

=TEXTJOIN("/", TRUE, IF(MATCH(AN4:AN23, AN4:AN23, 0)=MATCH(ROW(AN4:AN23), ROW(AN4:AN23)), AN4:AN23, ""))

Currently it adds the "/" as a pefix to the end of all values but i need this removing so it shows like the below format.

Example 1 unique value only:

80g

Example 2

80g/90g
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
If your version of Excel 365 has the UNIQUE function then maybe something like this:

Book1
AB
1Example 1
280g
345g80g/45g/70g
470g
545g
680g
7
8Example 2
980g80g
1080g
1180g
1280g
Sheet1
Cell Formulas
RangeFormula
B3B3=TEXTJOIN("/",1,UNIQUE(A2:A6))
B9B9=TEXTJOIN("/",1,UNIQUE(A9:A12))
 
Upvote 0
Currently it adds the "/" as a pefix to the end of all values but i need this removing so it shows like the below format.
Whilst AhoyNC has given you a simple formula if you have the UNIQUE function, I don't understand what you are saying about your current formula??

Example - 1 unique value only. There is no "/" here
20 07 28.xlsm
ANAO
4aaaa
5aa
6aa
7aa
8aa
9aa
10aa
11aa
12aa
13aa
14aa
15aa
16aa
17aa
18aa
19aa
20aa
21aa
22aa
23aa
TEXTJOIN
Cell Formulas
RangeFormula
AO4AO4=TEXTJOIN("/", TRUE, IF(MATCH(AN4:AN23, AN4:AN23, 0)=MATCH(ROW(AN4:AN23), ROW(AN4:AN23)), AN4:AN23, ""))



Example - More than 1 unique value. Output appears to be as you are asking for.
20 07 28.xlsm
ANAO
4aaaa/bb/cc/x
5bb
6cc
7bb
8cc
9x
10x
11x
12x
13x
14x
15x
16x
17x
18x
19x
20x
21x
22x
23x
TEXTJOIN
Cell Formulas
RangeFormula
AO4AO4=TEXTJOIN("/", TRUE, IF(MATCH(AN4:AN23, AN4:AN23, 0)=MATCH(ROW(AN4:AN23), ROW(AN4:AN23)), AN4:AN23, ""))



=TEXTJOIN("/", TRUE, IF(MATCH(AN4:AN23, AN4:AN23, 0)=MATCH(ROW(AN4:AN23), ROW(AN4:AN23)), AN4:AN23, ""))
BTW, you can write your formula a bit more simply like this
=TEXTJOIN("/", TRUE, IF(MATCH(AN4:AN23, AN4:AN23, 0)=ROW(AN4:AN23)-ROW(AN4)+1, AN4:AN23,""))
 
Upvote 0
Thank you for replying & taking your time out of your busy day.

After posting this thread I found out the root cause of the issue as the range I was applying the formula above had an erroneous space which caused the formula to apply the "/" prefix.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
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