You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Excel基于单单元格多选项VLOOKUP匹配后返回Y/N的实现咨询

单元格多值匹配返回Y/N实现需求

需求说明

需要对单个单元格内逗号分隔的多个选中值做VLOOKUP匹配,匹配依据为输入表的两个条件:

  • opt LCD vendor列的筛选条件
  • 功能用例列选中的、分号分隔的多值内容
    匹配完成后需在下一工作表的单个单元格中返回结果Y/N,返回规则如下:

仅当所有选中的功能用例匹配结果均为Y时返回Y;只要有任意一个匹配结果为N,即使其余都为Y也整体返回N。

输入表参考截图:
输入表截图1
输入表截图2

现有实现

目前已通过VBA实现了功能用例列与另外两列的下拉多选功能,代码如下:

Private Sub Worksheet_Change(ByVal Target As Range)
' 实现Excel下拉列表多选(无重复值)
Dim Oldvalue As String
Dim Newvalue As String
Application.EnableEvents = True
On Error GoTo Exitsub
'MsgBox "called" + ActiveSheet.Name + "::" + Target.Address

If ActiveSheet.Name = "Input" Then
    If (Target.Column = 19 Or Target.Column = 6 Or Target.Column = 13) Then
    'If Target.Address = "O" Then
      If Target.SpecialCells(xlCellTypeAllValidation) Is Nothing Then
        GoTo Exitsub
      Else: If Target.Value = "" Then GoTo Exitsub Else
        Application.EnableEvents = False
        Newvalue = Target.Value
        Application.Undo
        Oldvalue = Target.Value
          If Oldvalue = "" Then
            Target.Value = Newvalue
          Else
            If InStr(1, Oldvalue, Newvalue) = 0 Then
                Target.Value = Oldvalue & ", " & Newvalue
          Else:
            Target.Value = Oldvalue
          End If
        End If
      End If
    End If
End If
Application.EnableEvents = True
Exitsub:
Application.EnableEvents = True
End Sub

待解决问题

不确定该匹配需求通过VBA还是Excel公式实现更合适,求可行的实现方案。


内容的提问来源于stack exchange,提问作者Rathi

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.10.03 09:39:02