简体   繁体   English

索引indirect.ext匹配公式-遇到最后一个障碍

[英]index indirect.ext match formula - falling at last hurdle

I'm using an INDEX MATCH function to pull seasonal rainfall for ~200 field sites from weather station data into one summary file. 我正在使用INDEX MATCH函数将200个现场站点的季节性降雨从气象站数据中提取到一个摘要文件中。

Each weather station is in a different excel file. 每个气象站均位于不同的excel文件中。

Different field sites need data from the weather station closest to them. 不同的野外站点需要来自距离他们最近的气象站的数据。

I can do it successfully one weather station at a time using the following formula: 我可以使用以下公式一次成功地完成一个气象站的操作:

=INDEX('PATH\BB.xlsx'!rain,(MATCH($I$4&$I$5,PATH\BB.xlsx'!year&'PATH\BB.xlsx'!season,0)))

where 哪里

• PATH = file location (I can type this out as it's always the same) •PATH =文件位置(我可以输入它,因为它总是一样)

• BB.xlsx = Filename.xlsx •BB.xlsx =文件名.xlsx

• rain, year and season are named ranges in the weather station workbooks •降雨,年份和季节在气象站工作簿中被命名为范围

• $I$4 = cell containing the lookup value for year •$ I $ 4 =包含年份查询值的单元格

• $I$5 = cell containing the lookup value for season •$ I $ 5 =包含季节查询值的单元格

However, this means manually changing the filename in the formula for each field site. 但是,这意味着在每个现场站点的公式中手动更改文件名。

I'm therefore trying to write one formula that will automatically go to the correct weather station file to find the correct rainfall value. 因此,我正在尝试编写一个公式,该公式将自动转到正确的气象站文件中以找到正确的降雨量值。

I found out about the MOREFUNC add-in from this post and I then based my formula on this post. 我从这篇文章中找到了有关MOREFUNC加载项的信息,然后根据文章建立了公式。

This is my formula: 这是我的公式:

=INDEX(INDIRECT.EXT("'PATH["&$F8&"]seasonaldata'!"&$K$3),MATCH(1,(INDIRECT.EXT("'PATH["&$F8&"]seasonaldata'!"&$K$5)=I5)*(INDIRECT.EXT("'PATH["&$F8&"]seasonaldata'!"&$K$4)=I4),0))

where 哪里

• PATH = file location (I can type this out as it's always the same) •PATH =文件位置(我可以输入它,因为它总是一样)

• $F8 = Filename.xlsx (this is the name of the workbook I want to go to) •$ F8 = Filename.xlsx(这是我要转到的工作簿的名称)

• seasonaldata = sheet name •季节性数据=工作表名称

• $K$3 = lookup range (in fact K3 is a cell containing the word 'rain', which is the name of the lookup range in the weather station files) •$ K $ 3 =查找范围(实际上,K3是包含单词“ rain”的单元格,这是气象站文件中查找范围的名称)

• $K$5 = --> including a certain season (ie cell K5 contains the name of a range where excel should look for the relevant season) •$ K $ 5 =->包括特定的季节(即单元格K5包含excel应查找相关季节的范围的名称)

• $K$4 = --> including a certain year (ie cell K4 contains the name of a range where excel should look for the relevant year) •$ K $ 4 =->包括特定年份(即单元格K4包含excel应在相关年份中查找的范围的名称)

• I5 = cell containing one of the lookup values, which is a name (a season, ie winter) •I5 =包含一个查找值的单元格,这是一个名称(一个季节,即冬天)

• I4 = cell containing the other lookup value, which is a number (a year, ie 2013) •I4 =包含其他查找值的单元格,该值是一个数字(一年,即2013年)

The formula works until the very last part, 该公式一直有效到最后一部分,

'PATH["&$F8&"]seasonaldata'!"&$K$4)=I4

It finds the years and correctly identifies the year I've specified in cell I4, but then returns all FALSE values, ie it isn't matching the value I specify in cell I4 with the values it's found in the 'year' range. 它找到年份并正确标识我在I4单元格中指定的年份,然后返回所有FALSE值,即它与我在I4单元格中指定的值与在“ year”范围内找到的值不匹配。

What am I doing wrong? 我究竟做错了什么?

Thank you. 谢谢。

我自己解决了-这是答案,以防将来对任何人有用:

=INDEX(INDIRECT.EXT("'PATH ["&$F8&"]seasonaldata'!"&$K$3),(MATCH($I$4&$I$5,(INDIRECT.EXT("'PATH["&$F8&"]seasonaldata'!"&$K$4))&(INDIRECT.EXT("'PATH["&$F8&"]seasonaldata'!"&$K$5)),0)))

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

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