如何使用INDIRECT函数在表名动态更改的情况下选择带有公式的工作表。

huangapple go评论65阅读模式
英文:

How to select a sheet with a formula while sheet name change dynamically with INDIRECT

问题

I would like to set an ARRAYFORMULA or something similar in C3 which can read a sheet while name is changing dynamically with INDIRECT, so I can get the positions of each value with XMATCH:

如何使用INDIRECT函数在表名动态更改的情况下选择带有公式的工作表。

What's inside a sheet

I first tried to do this in D3:

XMATCH(A3:A;INDIRECT(B3:B&"!$1:$1"))

But 2 problems with this:
1: Length of Column A and B can change dynamically, so C has to be dynamic.
2: Not clean

In C3 I set the following formula:

ARRAYFORMULA(XMATCH(A3:A;INDIRECT(B3:B&"!$1:$1")))

and also tried:

ARRAYFORMULA(XMATCH(A3:A;query(INDIRECT(B3:B&"!$1:$1");"select *")))

You can see this works only for the first sheet name "WHISKEY.US" and it seems pretty logical.

My bet is we have to use a MAP, but the number of sheets may change, so we cannot initialize things.

英文:

I would like to set an ARRAYFORMULA or something similar in C3 which can read a sheet while name is changing dynamically with INDIRECT , so I can get the postions of each values with XMATCH :

如何使用INDIRECT函数在表名动态更改的情况下选择带有公式的工作表。

What's inside a sheet

I first tried to do this in D3:

> XMATCH(A3:A;INDIRECT(B3:B&"!$1:$1"))

But 2 problems with this :
1: Length of Column A and B can change dynamically, so C has to be dynamic.
2: Not clean

In C3 I set the following formula :

> ARRAYFORMULA(XMATCH(A3:A;INDIRECT(B3:B&"!$1:$1")))

and also tried :

> ARRAYFORMULA(XMATCH(A3:A;query(INDIRECT(B3:B&"!$1:$1");"select *")))

You can see this works only for the first sheet name "WHISKEY.US" and it seems pretty logical.

My bet is we have to use a MAP , but number of sheets may change so we cannot initialize things.

答案1

得分: 1

=map(A3:A;B3:B;lambda(a;b;if(len(a)*len(b);xmatch(a;indirect(b&"!1:1");)))

英文:

Can you give a shot at:

=map(A3:A;B3:B;lambda(a;b;if(len(a)*len(b);xmatch(a;indirect(b&"!1:1"));)))

huangapple
  • 本文由 发表于 2023年4月13日 23:24:10
  • 转载请务必保留本文链接:https://go.coder-hub.com/76007225.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定