简体   繁体   English

强大的查询功能可根据2个条件获取值

[英]Power Query to fetch values based on 2 criterias

I am trying to create a query based on below requirement. 我正在尝试根据以下要求创建查询。 So far I am able to do my query based on single criteria only. 到目前为止,我只能基于单个条件进行查询。 Your help would be much appreciated. 您的帮助将不胜感激。

1) I have opened a target workbook where I want to fetch matching values for it's two columns (temperature & density) from multiple workbooks saved in a particular folder. 1)我打开了一个目标工作簿,我要从保存在特定文件夹中的多个工作簿中为其两列(温度和密度)获取匹配值。 Here I am referring to New Query > From file > From Folder option. 在这里,我指的是“新建查询”>“来自文件”>“来自文件夹”选项。

2) So In my target work book I have Observed Density and Observed Temperature and now I want to extract volume and weight correction factors from a pool of mutilple workbooks picked in step 1 as mentioned above (all the workbooks in the desired folder not only have Observed Desnity and Observed Temperature but also columns contaning corresponding weight and volume correction factors in them) 2)因此,在我的目标工作簿中,我具有观测的密度和观测的温度,现在我要从上述步骤1中选择的多用途工作簿池中提取体积和重量校正因子(所需文件夹中的所有工作簿不仅具有观察到的密度和观察到的温度,以及其中包含相应重量和体积校正因子的列)

That's it. 而已。 Just want to know if this can be achieved using Power Query or VBA is a must do do get results? 只想知道是否可以使用Power Query或VBA做到这一点? If so, any hints would be much appreciated. 如果是这样,任何提示将不胜感激。

I think you are on the right track. 我认为您在正确的轨道上。 I would finish building the Query using the From Folder option to turn the data from all the workbooks into a single dataset. 我将使用“从文件夹”选项完成构建查询,以将所有工作簿中的数据转换为单个数据集。 This query does not need to be loaded into an Excel table. 该查询不需要加载到Excel表中。

Then I would start a new query based on the 2 columns in your target workbook. 然后,我将基于目标工作簿中的2列开始一个新查询。 They will need to be in a table or named range. 它们将需要在表或命名范围内。 In that query you can add a Merge step to match to rows in the From Folder query. 在该查询中,您可以添加一个“合并”步骤以匹配“来自文件夹”查询中的行。 Then Expand the results to add the columns you need from the matching rows. 然后,展开结果以从匹配的行中添加所需的列。

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

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