Excel中的搜索字段,带有分隔文本

时间:2018-03-21 14:02:57

标签: excel text vlookup delimited

我有这种格式的数据(DELIMITED TEXT)

Delimited Text Data

我如何Vlookup "F88"获得1动态价值。

Vlookup particular data from the text

非常感谢

1 个答案:

答案 0 :(得分:0)

将您发布的数据放在 A1 中,试一试:

Sub DataGrsbber()
    Dim s As String
    s = Replace([A1], "'", "")
    ary = Split(s, ",")
    For i = LBound(ary) To UBound(ary) - 1
        If ary(i) = "F88" Then
            MsgBox ary(i + 1)
            Exit Sub
        End If
    Next i
End Sub

enter image description here

修改#1:

要将值检索到单元格中,请尝试使用此用户定义函数:

Public Function Retriever(BigString As String, LittleString As String) As String
    Dim s As String
    s = Replace(BigString, "'", "")
    ary = Split(s, ",")
    For i = LBound(ary) To UBound(ary) - 1
        If ary(i) = LittleString Then
            Retriever = ary(i + 1)
            Exit Function
        End If
    Next i
    Retriever = ""
End Function

enter image description here