简体   繁体   English

使用 ARRAYFORMULA 扩展一个困难的公式,同时避免循环引用(谷歌表格)

[英]Expanding a difficult formula using ARRAYFORMULA while avoiding circular references (Google Sheets)

I'm trying to set up a formula in Google Sheets that does this...我正在尝试在 Google 表格中设置一个公式来执行此操作...

=IF(IFERROR(INDEX(Matches!$L$2:$L,MATCH($A2&(B$1-14),Matches!$H$2:$H&Matches!$M$2:$M,0)))=1,
IFERROR(OFFSET($A$1,INDEX(Matches!$I$2:$I,MATCH($A2&(B$1-14),Matches!$H$2:$H&Matches!$M$2:$M,0)),COLUMN()-1)-(1/(2*($A2)^2))),
$A2)

That is to say, IF(match was won, take the current period's rank of your defeated opponent and do math to it, else show last period's rank).也就是说,IF(比赛赢了,取你被击败的对手的当前时期的排名并计算它,否则显示上一时期的排名)。

But I want to set it into an ARRAYFORMULA so that it will expand automatically.但我想将其设置为 ARRAYFORMULA 以便它自动扩展。 What I have is this (and it doesn't work):我所拥有的是这个(它不起作用):

=ARRAYFORMULA(IF(IFERROR(VLOOKUP($A$2:$A&($B$1:$1-14),{Matches!$H$2:$H&Matches!$M$2:$M,Matches!$L$2:$L},2,0))=1,
OFFSET($A$1,VLOOKUP($A$2:$A&($B$1:$1-14),{Matches!$H$2:$H&Matches!$M$2:$M,Matches!$I$2:$I},2,0),SEQUENCE(1,COUNTA($B$1:$1),2,1))-(1/(2*($A$2:$A)^2)),
$A$2:$A))

What it should look like is this:它应该是这样的:

https://i.stack.imgur.com/Ui3nE.png https://i.stack.imgur.com/Ui3nE.png

How it actually comes out is:它的实际结果是:

https://i.stack.imgur.com/tQOl7.png https://i.stack.imgur.com/tQOl7.png

All of those errors are the same message, which is that VLOOKUP couldn't find 143997, which is just the first value pair.所有这些错误都是相同的消息,即 VLOOKUP 找不到 143997,这只是第一个值对。 I've tried using VLOOKUP/MATCH, but it produces a circular reference error.我试过使用 VLOOKUP/MATCH,但它会产生循环引用错误。

Is this possible?这可能吗? I'm willing to believe it's not, but I thought I should ask.我愿意相信它不是,但我想我应该问。 Thanks for any help you can offer.谢谢你尽你所能的帮助。

You can't use that OFFSET formula within ARRAYFORMULA .您不能在ARRAYFORMULA中使用该OFFSET公式。 When the VLOOKUP throws an error the OFFSET is not able to handle it.VLOOKUP抛出错误时, OFFSET无法处理它。 That's why it won't work.这就是为什么它不起作用。 You should apply your math on the output of the VLOOKUP .您应该在VLOOKUP的 output 上应用您的数学。

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

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