简体   繁体   中英

Importrange() where the source columns/rows change

I have an importrange("key", "sheet1!D" & targetRow) formula, but I also need the column of the importrange() to be dynamic too in case I add/delete columns in the source data:

Eg importrange("key", "sheet1!" &targetColumn &targetRow)

I researched query() language but being forced to use Col1 , Col2 etc instead of named column identifiers makes this useless for what I'm trying to achieve.

Can someone help me with this? Easiest way to get column letters without a script? Thanks very much.

I've figured out a somewhat inelegant workaround:

=IMPORTRANGE("key", "Sheet!" & IMPORTRANGE("key", "Dept") & targetRow)

Where "Dept" is a single-cell named range that contains the column letter of the column I want.

The column letter (eg 'K') is the result of the following formula:

=substitute(address(row(K6), column(K6),4), row(K6),"")

Is there really no easier/more robust way of doing this? This will be used to calculate bonuses so it's actually a very critical spreadsheet.

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