首页 > 解决方案 > 如何使 Excel Power Query 根据工作表中单元格的值过滤数据?

问题描述

所以这就是我能走多远

let
    Source = Excel.Workbook(File.Contents("C:\Port Inventory.xlsx"), null, true),
    #"All in one_Sheet" = Source{[Item="All in one",Kind="Sheet"]}[Data],
    #"Promoted Headers" = Table.PromoteHeaders(#"All in one_Sheet", [PromoteAllScalars=true]),
    #"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{"Switch", type text}, {"Port", type text}, {"Name", type text}, {"Column2", type text}, {"Column1", type any}, {"Status", type text}, {"Vlan", type any}, {"Duplex", type text}, {"Speed", type any}, {"Type", type text}, {"Description", type text}, {"Migrated", type text}}),
    #"Filtered Rows" = #!"Table.SelectRows(#""Changed Type"", each [Switch] = 'Migration sheet'!D2)"
in
    #"Filtered Rows"

我不知道如何在当前工作簿中引用工作表的单元格。我想这[Switch] = 'Migration sheet'!D2需要在倒数第三行替换为其他内容

我想将此查询用作下拉列表的数据源。假设单元格 D2 包含我要过滤的值。这将在 Power Query 中使用,该 Power Query 将用作与 C2 相邻的单元格 (E2) 的淹没选项的列表

标签: excelpowerquery

解决方案


推荐阅读