简体   繁体   English

带有 IF 的 Google 表格 ARRAYFORMULA

[英]Google Sheet ARRAYFORMULA with IF

I am using IF function as below and getting the result, but when I use the same function with ARRAYFORMULA am getting the circulating dependency error:我正在使用 IF function 如下并获得结果,但是当我使用与 ARRAYFORMULA 相同的 function 时,出现循环依赖错误:

Without ARRAYFORMULA =if(isblank(A2),"",IFERROR(IF(A2<>A2,1,B1+1) ))没有 ARRAYFORMULA =if(isblank(A2),"",IFERROR(IF(A2<>A2,1,B1+1) ))

With ARRAYFORMULA =ARRAYFORMULA(IF(A2:A<>A2:A,1,C1:C+1) )使用 ARRAYFORMULA =ARRAYFORMULA(IF(A2:A<>A2:A,1,C1:C+1) )

Further, the result of formula is getting started from cell No. B3, is it possible to get the result started from cell B2 ie the cell in which the formula is applied.此外,公式的结果是从B3号单元格开始的,是否有可能从B2号单元格即应用公式的单元格开始得到结果。

Below is the link of the sheet:以下是工作表的链接:

https://docs.google.com/spreadsheets/d/1qLjYukNR1E_vgwqeGutQRtg3H7-3eU2heUPHsqQpg90/edit#gid=1713558709 . https://docs.google.com/spreadsheets/d/1qLjYukNR1E_vgwqeGutQRtg3H7-3eU2heUPHsqQpg90/edit#gid=1713558709

Any help on above will be greatly appreciated.上述任何帮助将不胜感激。

I have added a new sheet ("Erik Help") to your sample spreadsheet.我在您的示例电子表格中添加了一个新工作表(“Erik 帮助”)。 This array formula can be found in B1 of that sheet:这个数组公式可以在该表的 B1 中找到:

=ArrayFormula({"Header"; IF(A2:A="",, ROW(A2:A)-VLOOKUP(ROW(A2:A),{1;FILTER(ROW(A2:A),A2:A="")},1,TRUE))})

You can change the header text as you like.您可以随意更改 header 文本。

Here is a plain-English interpretation of the rest of the formula: "If a cell in A2:A is blank, leave it empty; otherwise, subtract the row number of the last empty row from the current non-blank row number. If A2 is non-blank, return 1."下面是对rest公式的简单英文解释:“如果A2:A中的单元格为空,则留空;否则,从当前非空行号中减去最后一个空行的行号。如果A2 非空白,返回 1。”

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

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