是否可以将公式定位到该公式下方的单元格?我有一个复杂的公式,可以跨多个列和行进行转置和构建结果。我喜欢对数据进行排序和过滤,因此该公式最终会四处移动,因为它位于数据的第一个单元格中。
例如,第1行被冻结,并具有每一列的标题。我在A2中有公式,并且数据一直沿A向下填充到B,C和D。如果我对A列进行排序或过滤,则公式将移动。我想将公式向上移动到标题栏(A1)中,以便它停留在同一位置且永不移动。但我希望它仍然填充从A2开始的数据。然后,我还希望标题单元格(A1)仍显示列标题的文本,而不是公式...。因此,基本上将公式隐藏在单元格的背景中。这可能吗?
编辑:
https://docs.google.com/spreadsheets/d/1MbvMGhrVNhXGfMi4Q5VjwODLgDpKtXtMj0PtKre3Q2U/edit?usp=sharing
添加了一个示例,以获得更好的视觉效果,使我的问题更清晰。基本上,我现在所拥有的是A2“ Data1”单元格中填充A2:C的公式。它会根据显示数据所需的垂直和水平方向进行填充和转置。这将自动填充单元格。我想将公式本身移动到A1(“标题1”)中,但单元格仍显示为“标题1”。当我这样做时,我会丢失Data1,Data2,Data3,因为它将公式的整个结果向上移动了1行。我想强制将结果下推1行,以便结果保持不变,但公式与冻结的条形挂钩。
答案 0 :(得分:2)
基本上,您要求这样做:
={"header for A", "header for B"; ARRAYFORMULA(A2:B)}
请注意,为避免数组错误,即使空""
={""; ARRAYFORMULA(IFERROR(SUBSTITUTE(SPLIT(TRIM(
TRANSPOSE(QUERY(TRANSPOSE(SUBSTITUTE(IF(LEN($A$3:$L), {
IF(TRANSPOSE(QUERY(TRANSPOSE($A$3:$L),,999^99))=IFERROR(VLOOKUP(
TRANSPOSE(QUERY(TRANSPOSE($A$3:$L),,999^99)),
TRANSPOSE(QUERY(TRANSPOSE('T1'!$A$3:$L),,999^99)),1,0)), "T1", ),
IF(TRANSPOSE(QUERY(TRANSPOSE($A$3:$L),,999^99))=IFERROR(VLOOKUP(
TRANSPOSE(QUERY(TRANSPOSE($A$3:$L),,999^99)),
TRANSPOSE(QUERY(TRANSPOSE('B1'!$A$3:$L),,999^99)),1,0)), "B1", ),
IF(TRANSPOSE(QUERY(TRANSPOSE($A$3:$L),,999^99))=IFERROR(VLOOKUP(
TRANSPOSE(QUERY(TRANSPOSE($A$3:$L),,999^99)),
TRANSPOSE(QUERY(TRANSPOSE('T2'!$A$3:$L),,999^99)),1,0)), "T2", ),
IF(TRANSPOSE(QUERY(TRANSPOSE($A$3:$L),,999^99))=IFERROR(VLOOKUP(
TRANSPOSE(QUERY(TRANSPOSE($A$3:$L),,999^99)),
TRANSPOSE(QUERY(TRANSPOSE('B2'!$A$3:$L),,999^99)),1,0)), "B2", ),
IF(TRANSPOSE(QUERY(TRANSPOSE($A$3:$L),,999^99))=IFERROR(VLOOKUP(
TRANSPOSE(QUERY(TRANSPOSE($A$3:$L),,999^99)),
TRANSPOSE(QUERY(TRANSPOSE('M1'!$A$3:$L),,999^99)),1,0)), "M1", ),
IF(TRANSPOSE(QUERY(TRANSPOSE($A$3:$L),,999^99))=IFERROR(VLOOKUP(
TRANSPOSE(QUERY(TRANSPOSE($A$3:$L),,999^99)),
TRANSPOSE(QUERY(TRANSPOSE('B3'!$A$3:$L),,999^99)),1,0)), "B3", ),
IF(TRANSPOSE(QUERY(TRANSPOSE($A$3:$L),,999^99))=IFERROR(VLOOKUP(
TRANSPOSE(QUERY(TRANSPOSE($A$3:$L),,999^99)),
TRANSPOSE(QUERY(TRANSPOSE('M2'!$A$3:$L),,999^99)),1,0)), "M2", ),
IF(TRANSPOSE(QUERY(TRANSPOSE($A$3:$L),,999^99))=IFERROR(VLOOKUP(
TRANSPOSE(QUERY(TRANSPOSE($A$3:$L),,999^99)),
TRANSPOSE(QUERY(TRANSPOSE('B4'!$A$3:$L),,999^99)),1,0)), "B4", )}, ),
" ", "♦")),,999^99))), " "), "♦", " ")))}
注意::如果您获得ARRAY LITERAL error
,则需要添加更多""
,例如:={"", "", "", ""; ARRAYF....