textjoin + filter formula

valmir

Board Regular
Joined
Feb 10, 2021
Messages
239
Office Version
  1. 365
Platform
  1. Windows
Hello everyone!
For better clarification, I have attached a sample file:
1. The formula in "D1" instead of "A2", I want to search by the name which is "ACA"
2. I also would like to combine two different names instead of just one, for example COU+DCH
3. In E1 I would like to have the number of occurrences. For ACA the result should be 3
I hope my explanation is clear enough!
Thanks!

zztest file.xlsx
ABCDE
114A1979ACA1979, 1981, 1982
2ACA1979COU1979, 1981, 1982, 1984
3COU1979DCH1979, 1981, 1982, 1984
4DCH1979DTA1979, 1981, 1982, 1984
5DIA1979DVE1979
6DTA1979
7DVE1979
8EST1979
9FCC1979
10FCU1980
11FHL1980
12MAM1980
13NAC1980
14PAL1980
15PRI1980
16SAG1980
17SAS1980
18WEL1980
19ACA1981
20COU1981
21DCH1981
22DTA1981
23FCU1981
24ACA1982
25COU1982
26DBG1982
27DCH1982
28DTA1982
29PET1983
30PHU1983
31PRI1983
32PRM1983
33PRO1983
34COU1984
35DBG1984
36DCH1984
37DTA1984
38FHL1984
39INT1984
40MAM1984
41NAC1984
42PET1984
43PHU1984
44PRI1984
45PRM1984
46PRO1984
47SAG1984
Sheet1
Cell Formulas
RangeFormula
D1:D3D1=TEXTJOIN(", ", TRUE, FILTER($B:$B,A:A=A2))
D4:D5D4=TEXTJOIN(", ", TRUE, FILTER($B:$B,A:A=A6))
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
Upvote 0
I figured out myself. The formula in D1 should look like this:
Excel Formula:
=TEXTJOIN(", ", TRUE, FILTER($B:$B,A:A="ACA"))
I tried this before, I just forgot to include the quotation marks and was getting an error as a result. Now I just need someone to help with point 2 which is searching for two names instead of one!
 
Upvote 0
The solution to point 2 in my request looks like this:
Excel Formula:
=(TEXTJOIN(", "; TRUE; IF(B:B="COU"; C:C; "")) & IF(COUNTIF(B:B; "COU")>0; "; "; "") & TEXTJOIN(", "; TRUE; IF(B:B="DCH"; C:C; "")))
 
Upvote 0

Forum statistics

Threads
1,215,883
Messages
6,127,540
Members
449,385
Latest member
KMGLarson

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