在这个机会中,我需要一些支持,以建立一个VBA函数以在Vlookup适应调用下提取多个值,而我自己无法正确完成它
初始数据库:
CODE Description
824110111841 BRP391
824110112161 BY698P
824110112451 BRP391
824110112541 BRP392
824110112781 BRP391
824110112791 BRP391
824110112801 BRP391
提取信息DB2:
CODE Description Country STOCKS
824110111841 BRP391 Uruguay 100
824110111841 BRP391 Chile 200
824110111841 BRP391 Argentina 32
824110111841 BRP391 Bolivia 45
824110112161 BY698P Argentina 12
824110112161 BY698P Uruguay 100
824110112161 BY698P Peru 120
824110112451 BRP391 Argentina 440
824110112541 BRP392 Argentina 550
824110112781 BRP391 Uruguay 241
824110112781 BRP391 Chile 77
824110112791 BRP391 Peru 222
824110112801 BRP391 Bolivia 100
最终所需输出:
CODE Description STOCKS OVERVIEW
824110111841 BRP391 Uruguay: 100 | Chile: 200 | Argentina: 32 | Bolivia: 45
824110112161 BY698P Argentina: 12 | Uruguay: 100 | Peru: 120
824110112451 BRP391 Argentina: 440
824110112541 BRP392 Argentina: 550
824110112781 BRP391 Uruguay: 241 | Chile: 77
824110112791 BRP391 Peru: 222
824110112801 BRP391 Bolivia: 100
看,我所做的是将多个多个vlookup匹配项串联在一起,并将它们结合在一起。
XX。
答案 0 :(得分:0)
我终于找到了如何独自完成我的想法的方法,如果有人需要此功能,我会发布帖子以帮助SO社区。 p>
Option Explicit
Function SLOWMOVER(value As String, WorkRng As Range, col As Long)
Dim rng As Range
Dim Fx As String
Fx = ""
For Each rng In WorkRng
If rng = value Then
Fx = Fx & "| " & rng.Offset(0, col - 2) & ": " & rng.Offset(0, col - 1)
End If
Next
SLOWMOVER = Fx
End Function
''' Credit to extendedoffice.com where i saw a similar example which i adapted to solve my problem.
致谢!
P.D:这是我上传到该社区的第三篇文章,而且我总是收到不好的代表,我非常感谢至少得到反馈,以便我可以更好地处理我的询问,而不仅仅是获得差的资格。