Hi can anyone help please, I am trying to create a formula that looks down a list of data and concatenates the names of two if conditions are met? So in the example of shop is A and region is North then concatenate names save and Mike. Thanks!
I cant test this as my version of excel doesnt have TEXTJOIN but I believe 2016 does.Hi can anyone help please, I am trying to create a formula that looks down a list of data and concatenates the names of two if conditions are met? So in the example of shop is A and region is North then concatenate names save and Mike. Thanks!
=TEXTJOIN(",",TRUE,IF(($A2:$A9="A")*($B2:$B9="North"),$C2:$C9,""))
temporarily on a different machine, was sure i had used textjoin on my personal comp. guess it must have been on the works one. always happy to admit when wrongBut your profile shows you are using 2016.
However 2016 doesn't have textjoin.
Book3.xlsx | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
A | B | C | D | E | F | G | H | I | |||
1 | North | South | |||||||||
2 | A | North | Dave | A | Dave,Mike | ||||||
3 | B | South | Bob | B | Bob,Larry | ||||||
4 | C | North | Tony | C | Tony | ||||||
5 | D | South | Gary | D | Gary | ||||||
6 | E | North | Steve | E | Steve | ||||||
7 | F | South | Trevor | F | Trevor | ||||||
8 | B | South | Larry | ||||||||
9 | A | North | Mike | ||||||||
Sheet5 |
Cell Formulas | ||
---|---|---|
Range | Formula | |
H2:I7 | H2 | =SUBSTITUTE(TRIM(IFERROR(INDEX($C$2:$C$9,MATCH($G2&H$1,$A$2:$A$9&$B$2:$B$9,0)),"")&" "&IF(IFERROR(LOOKUP(2,1/SEARCH($G2&H$1,$A$2:$A$9&$B$2:$B$9),$C$2:$C$9),"")=IFERROR(INDEX($C$2:$C$9,MATCH($G2&H$1,$A$2:$A$9&$B$2:$B$9,0)),""),"",IFERROR(LOOKUP(2,1/SEARCH($G2&H$1,$A$2:$A$9&$B$2:$B$9),$C$2:$C$9),"")))," ",",") |
Press CTRL+SHIFT+ENTER to enter array formulas. |
Thanks to you both, unfortunately it seems textjoin isn’t available for excel 2016…Hi,
This is Ugly, and Only works if there are no more than 2 matches.
If there are more than 2 matches, I would think a UDF or VBA solution is more suitable:
Book3.xlsx
A B C D E F G H I 1 North South 2 A North Dave A Dave,Mike 3 B South Bob B Bob,Larry 4 C North Tony C Tony 5 D South Gary D Gary 6 E North Steve E Steve 7 F South Trevor F Trevor 8 B South Larry 9 A North Mike Sheet5
Cell Formulas Range Formula H2:I7 H2 =SUBSTITUTE(TRIM(IFERROR(INDEX($C$2:$C$9,MATCH($G2&H$1,$A$2:$A$9&$B$2:$B$9,0)),"")&" "&IF(IFERROR(LOOKUP(2,1/SEARCH($G2&H$1,$A$2:$A$9&$B$2:$B$9),$C$2:$C$9),"")=IFERROR(INDEX($C$2:$C$9,MATCH($G2&H$1,$A$2:$A$9&$B$2:$B$9,0)),""),"",IFERROR(LOOKUP(2,1/SEARCH($G2&H$1,$A$2:$A$9&$B$2:$B$9),$C$2:$C$9),"")))," ",",") Press CTRL+SHIFT+ENTER to enter array formulas.
You could employ a user-defined function like this. To implement ..Any other ideas or leads ?
Function Who(rData As Range, sShop As String, sRegion As String) As String
Dim d As Object
Dim a As Variant
Dim i As Long
Set d = CreateObject("Scripting.Dictionary")
a = rData.Value
For i = 1 To UBound(a)
d(a(i, 1) & "|" & a(i, 2)) = d(a(i, 1) & "|" & a(i, 2)) & "," & a(i, 3)
Next i
Who = Mid(d(sShop & "|" & sRegion), 2)
End Function
Manatarms.xlsm | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
A | B | C | D | E | F | G | H | I | |||
1 | Shop | Region | Name | North | South | ||||||
2 | A | North | Dave | A | Dave,Mike | ||||||
3 | B | South | Bob | B | Bob,Larry | ||||||
4 | C | North | Tony | C | Tony | ||||||
5 | D | South | Gary | D | Gary | ||||||
6 | E | North | Steve | E | Steve | ||||||
7 | F | South | Trevor | F | Trevor | ||||||
8 | B | South | Larry | ||||||||
9 | A | North | Mike | ||||||||
10 | |||||||||||
Sheet1 |
Cell Formulas | ||
---|---|---|
Range | Formula | |
H2:I7 | H2 | =Who($A$2:$C$9,$G2,H$1) |