Try this function
sheet1
| A | B | C | D |
| | | | |
apple | applez, apples, zapples, trapples | | applez | |
| | | apples | |
| | | brown | |
| | | yellow | |
| | | zapples | |
| | | trapples | |
<colgroup><col style="font-weight:bold; width:30px; "><col style="width:76.04px;"><col style="width:207.21px;"><col style="width:76.04px;"><col style="width:76.04px;"></colgroup><tbody>
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]1[/TD]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=92d050]#92d050[/URL] , align: center"]keyword[/TD]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=92d050]#92d050[/URL] , align: center"]Result[/TD]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=92d050]#92d050[/URL] , align: center"]List[/TD]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]2[/TD]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]3[/TD]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]4[/TD]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]5[/TD]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]6[/TD]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]7[/TD]
</tbody>
|
Cell | Function | B2 | =find_all_in_one(A2,D2:D7) |
<tbody>
</tbody> |
<tbody>
</tbody>
Code:
Function find_all_in_one(cell As Range, list As Range)
cad = ""
For Each c In list
If LCase(c.Value) Like "*" & LCase(cell.Value) & "*" Then cad = cad & ", " & c.Value
Next
If cad <> "" Then find_all_in_one = Mid(cad, 3) Else find_all_in_one = ""
End Function