Join multiple rows values in same cell, based on 2 conditions.

Dani_LobP

Board Regular
Joined
Aug 16, 2019
Messages
126
Office Version
  1. 365
Platform
  1. Windows
Hi,

I am trying to find the way to obtain a list of values in same cell, based on 2 conditions.
I seem to be struggling with the right way based on below formula:

=TEXTJOIN(", ",TRUE,UNIQUE(FILTER(ColumnB,(ColumnA=A2)*(ColumnC="Yes"),"")))

for some reason i obtain only 1 result instead of as in example below:

ABCD
Item1Country1YesCountry1, Country5
Item2Country2No
Item3Country3Yes
Item4Country4No
Item1Country5YesCountry1, Country5
Item2Country6No
Item3Country7Yes
Item4Country8No
Item1Country9No
Item2Country10No
Item3Country11Yes
Item4Country12No


thanks in advance!
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
item 3 in row 3 , that has a YES , why has than not returned some results

=TEXTJOIN(", ",TRUE,UNIQUE(FILTER($B$2:$B$100,(($A$2:$A$100=A2)*($C$2:$C$100="Yes")),"")))

Book3
ABCDEFGH
1ABCD
2Item1Country1YesCountry1, Country5Country1, Country5
3Item2Country2No 
4Item3Country3YesCountry3, Country7, Country11
5Item4Country4No 
6Item1Country5YesCountry1, Country5Country1, Country5
7Item2Country6No 
8Item3Country7YesCountry3, Country7, Country11
9Item4Country8No 
10Item1Country9NoCountry1, Country5
11Item2Country10No 
12Item3Country11YesCountry3, Country7, Country11
13Item4Country12No 
14
Sheet1
Cell Formulas
RangeFormula
G2:G13G2=TEXTJOIN(", ",TRUE,UNIQUE(FILTER($B$2:$B$100,(($A$2:$A$100=A2)*($C$2:$C$100="Yes")),"")))
 
Upvote 0
item 3 in row 3 , that has a YES , why has than not returned some results

=TEXTJOIN(", ",TRUE,UNIQUE(FILTER($B$2:$B$100,(($A$2:$A$100=A2)*($C$2:$C$100="Yes")),"")))
hi, thanks from prompt reply.
item 3 in row 3 indeed has Yes, i was just making some example manually so it was easy to understand my explanation in case of not being clear.
you are right about the result that should have.

So can it be that my mistake, is instead of using a range B2:B100, i am using the whole column? when i click on the cell, instead of B2, is appears the title of the column.
Does it make any difference for this purpose?
If apply formula using columns from table, i get single results, it wont join anything.

Excel Formula:
=TEXTJOIN(", ",TRUE,UNIQUE(FILTER([ColumnB],(([ColumnA]=A2)*([ColumnC]="Yes")),"")))

And if i apply your formula (using ranges) i will get results even when there is "No"... does it make sense?

i tried adding starter condition as maybe workaround... does it make sense?

Excel Formula:
=IF([ColumnC]="Yes",TEXTJOIN(", ",TRUE,UNIQUE(FILTER(B2:B100,((A2:A100=A2)*(C2:C100="Yes")),""))),"")
 
Upvote 0
it still works - with full column reference A:A etc
But i prefer to just use a range , as in excel using A:A is a huge range


Book3
ABCDEFGH
1ABCD
2Item1Country1YesCountry1, Country5Country1, Country5
3Item2Country2No 
4Item3Country3YesCountry3, Country7, Country11
5Item4Country4No 
6Item1Country5YesCountry1, Country5Country1, Country5
7Item2Country6No 
8Item3Country7YesCountry3, Country7, Country11
9Item4Country8No 
10Item1Country9NoCountry1, Country5
11Item2Country10No 
12Item3Country11YesCountry3, Country7, Country11
13Item4Country12No 
Sheet1
Cell Formulas
RangeFormula
G2:G13G2=TEXTJOIN(", ",TRUE,UNIQUE(FILTER(B:B,((A:A=A2)*(C:C="Yes")),"")))


If apply formula using columns from table, i get single results, it wont join anything.
not sure on tables - i tend to get mixed results and often just use a range

BUT - i have tried and seems ok

Book3
ABCDEFGHIJ
1ABCDUSING TABLE
2Item1Country1YesCountry1, Country5Country1, Country5Country1, Country5
3Item2Country2No  
4Item3Country3YesCountry3, Country7, Country11Country3, Country7, Country11
5Item4Country4No  
6Item1Country5YesCountry1, Country5Country1, Country5Country1, Country5
7Item2Country6No  
8Item3Country7YesCountry3, Country7, Country11Country3, Country7, Country11
9Item4Country8No  
10Item1Country9NoCountry1, Country5Country1, Country5
11Item2Country10No  
12Item3Country11YesCountry3, Country7, Country11Country3, Country7, Country11
13Item4Country12No 
14
15
Sheet1
Cell Formulas
RangeFormula
J2:J12J2=TEXTJOIN(", ",TRUE,UNIQUE(FILTER(Table1[B],((Table1[A]=A2)*(Table1[C]="Yes")),"")))
G2:G13G2=TEXTJOIN(", ",TRUE,UNIQUE(FILTER(B:B,((A:A=A2)*(C:C="Yes")),"")))



And if i apply your formula (using ranges) i will get results even when there is "No"... does it make sense?
NO, but look at the brackets , just to ensure they are the same as mine


i tried adding starter condition as maybe workaround... does it make sense?
No need to do that - it should work as i have written
 
Upvote 1
Solution
Ok I just realized what was going on.
Its giving me results in lines where Item is even No or Empty, but just because that same item has at some place a country and Yes, so it provides me that country with yes, for all equal items.
All good. Took me a bit to realize my own logic :D

Thanks a lot for the support etaf!
 
Upvote 0

Forum statistics

Threads
1,215,071
Messages
6,122,964
Members
449,094
Latest member
Anshu121

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