简体   繁体   English

从不同的工作表引用电源查询中的单元格值

[英]referencing cell value in power Query from different worksheet

I need to create several workbooks with power query which pulls prices for respective CustomerCode .我需要创建几个带有电源查询的工作簿,这些工作簿会拉取相应CustomerCode的价格。 I want to pull data based on a cell value from a different worksheet in that workbook我想根据该工作簿中不同工作表中的单元格值提取数据

let's say I have sheet1 cell("H9").value where it has the customer code, and another worksheet Price with power query.假设我有sheet1 cell("H9").value ,其中包含客户代码,另一个工作表Price带有电源查询。

in the power query formula, I have hard coded as below,在电源查询公式中,我硬编码如下,

= Table.SelectRows(#"Changed Type", each ([CustomerCode] = 123456))

but I want this CustomerCode to be a variable, referencing sheet1 Cell("H9").value ,但我希望这个CustomerCode是一个变量,引用sheet1 Cell("H9").value

= Table.SelectRows(#"Changed Type", each ([CustomerCode] = sheet1.Cell("H9").value ))

so when I create different workbooks with changed value in sheet1 Cell("H9").value , it will automatically pull the data for respective CustomerCode without having to go in the query to change the CustomerCode因此,当我在sheet1 Cell("H9").value中创建具有更改值的不同工作簿时,它将自动提取相应CustomerCode的数据,而无需在查询中使用 go 来更改CustomerCode

I am quite new to power query, can it be done in power query formula?我对电源查询很陌生,可以在电源查询公式中完成吗?

Thanks for your help in advance.提前感谢您的帮助。

I don't know about a cell address, but you can access data from a Named Range我不知道单元格地址,但您可以从命名范围访问数据

So, if Customer_Code refers to: Sheet1!H9 , you can use, in your code:因此,如果Customer_Code指的是: Sheet1!H9 ,您可以在代码中使用:

CustomerCode = Excel.CurrentWorkbook(){[Name="Customer_Code"]}[Content][Column1]{0}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM