简体   繁体   中英

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.

Each weather station is in a different excel file.

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)

• BB.xlsx = Filename.xlsx

• rain, year and season are named ranges in the weather station workbooks

• $I$4 = cell containing the lookup value for year

• $I$5 = cell containing the lookup value for season

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.

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)

• $F8 = Filename.xlsx (this is the name of the workbook I want to go to)

• 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$5 = --> including a certain season (ie cell K5 contains the name of a range where excel should look for the relevant season)

• $K$4 = --> including a certain year (ie cell K4 contains the name of a range where excel should look for the relevant year)

• I5 = cell containing one of the lookup values, which is a name (a season, ie winter)

• I4 = cell containing the other lookup value, which is a number (a year, ie 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.

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)))

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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