小编inu*_*nd8的帖子

我想要 VLOOKUP,但我希望能够看到“第 n”个唯一结果,而不仅仅是第一个

我想在 vba 中创建一个 Excel 函数,其工作方式与 VLOOKUP 相同,但有一个额外的参数让您选择第 n 个唯一结果。

这是迄今为止我想出的非工作代码。它不起作用,而且有点不完整,但我想你可以看到我要去的地方。

Function MVLOOKUP(lookup_value, table_array As Range, col_index_num As Long, entry_num As Long, Optional range_lookup As Boolean) As Variant
    '===========================
    'Purpose: VLOOKUP but it finds ALL the matching entries, not just the first one.
    'returns the entry you want by its number, starting at one
    'entry_num is the entry to return
    'most of this copied from top answer on this stackoverflow entry
    '/sf/ask/1447338231/
    
        Dim FoundCell As Range
        Dim LastCell As Range
        Dim …
Run Code Online (Sandbox Code Playgroud)

vba worksheet-function microsoft-excel

0
推荐指数
1
解决办法
136
查看次数

标签 统计

microsoft-excel ×1

vba ×1

worksheet-function ×1