[英]Google Sheets Formula Randomly Assign Values To A Column Skipping Row If Adjacent Cell = “Down”
I have 3 columns whose values are randomly generated using this formula 我有3列,其值是使用此公式随机生成的
=sort(A1:A36,arrayFormula(randbetween(sign(row(A1:A36)),1000000)),true)
and displayed in columns (H,I,J) and I would like to copy these values into 3 new columns (L,M,N) but skipping the entire row if an adjacent cell within the row = "Down" (Column O). 并显示在(H,I,J)列中,我想将这些值复制到3个新列(L,M,N)中,但如果该行中的相邻单元格为“ Down”(O列),则跳过整行。
Below is a screenshot of my current state and problem. 以下是我当前状态和问题的屏幕截图。
Below is a screenshot of what I want to accomplish using an excel formula. 下面是我要使用Excel公式完成的屏幕截图。 I currently just pasted the values to use as a reference of what I would like to accomplish.
目前,我只是粘贴了这些值以用作我要完成的工作的参考。
So, you want to copy the data from some columns to some other columns, but skipping the rows where the O column is "Down". 因此,您想将数据从某些列复制到另一些列,但是跳过O列为“ Down”的行。 Not really specific to randomness of those values.
并不是真正针对那些值的随机性。 Here is my approach:
这是我的方法:
=if(O2 <> "Down", offset(H$1, countif(O$1:O1, "<>Down"), 0, 1, 3), )
The offset
gets three cells in the row determined by countif
, which is based on the number of cells that are not "Down" above the current row. offset
由countif
确定的行中将获得三个单元格, countif
基于当前行上方不“向下”的单元格数量。 This formula would need to be entered on the second row and copied down. 该公式将需要在第二行中输入并向下复制。 I wasn't able to find a solution that gives the entire array at once with some
arrayformula
. 我找不到一个可以通过一些
arrayformula
一次提供整个阵列的解决方案。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.