Trong Excel không có tính năng như vậy vì thế bạn cần tạo hàm riêng để thực hiện việc này .
Mở Excel , bấm tổ hợp phím Alt-F11 để mở cửa sổ Visual Basic Editor .
Bấm menu Module và chọn Insert .
Bạn copy / paste nội dung bên dưới
Function FilterWords(rng As Range, str As String) As Variant()
Dim x As Variant, Wrds() As Variant, Cells_row As Long
Dim Cells_col As Long, Words As Long, y() As Variant
ReDim y(0)
Wrds = rng.Value
For Cells_row = LBound(Wrds, 1) To UBound(Wrds, 1)
For Cells_col = LBound(Wrds, 2) To UBound(Wrds, 2)
x = Split(Wrds(Cells_row, Cells_col))
For Words = LBound(x) To UBound(x)
If InStr(x(Words), str) Then
y(UBound(y)) = x(Words)
ReDim Preserve y(UBound(y) + 1)
End If
Next Words
Next Cells_col
Next Cells_row
ReDim Preserve y(UBound(y) - 1)
FilterWords = Application.Transpose(y)
Quay trở lại Excel .
Để lấy những địa chỉ email xuất hiện từ B1:M50 bạn gõ công thức như sau
Đánh dấu từ ô A1 tới A10 , sau đó gõ
= FilterWords(B1:M50, \"@\")
Sau đó bấm tổ hợp phím Ctrl + SHIFT + ENTER để tạo thành công thức mảng
Lúc đó bạn sẽ thấy kết quả như hình dưới