|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
工作表或选项卡名称:result
C2单元格公式,向下拖动
- =GV(data!$A$1:$A$4,B2,data!$B$1:$B$4)
复制代码
- Function GV(rngNames As Range, itemName As String, rngValues As Range) As Variant
- Dim nameIndex As Variant
- nameIndex = Application.Match(itemName, rngNames, 0)
- If IsError(nameIndex) Then
- GV = "Item not found"
- Exit Function
- End If
- Dim values() As String
- values = Split(rngValues.Cells(nameIndex).Value, ",")
- GV = values
- End Function
复制代码
A2单元格公式,向下拖动
- =CustomVLookup($B2,data!A:B,2)
复制代码
- Function CustomVLookup(valueToLookup As Variant, lookupRange As Range, colIndex As Long) As Variant
- If valueToLookup = "" Then
- CustomVLookup = ""
- Else
- CustomVLookup = Application.VLookup(valueToLookup, lookupRange, colIndex, False)
- End If
- End Function
复制代码 |
评分
-
2
查看全部评分
-
|