Excel IF -eq" Something"写下一个可用空格

时间:2018-04-09 19:19:07

标签: excel if-statement formula

如果声明为True,我在编写一个公式时会遇到一些麻烦,该公式将填充下一个可用的空白单元格。

如果G列等于" #Number"然后写'#34;这等于#" ...但我只想要"这等于#"在一个单元格上,而不是全部4个单元格(A1; A2; A3; A4)。 此外,如果' A1'已经包含" Something"写在' A2'

专栏:A; B; C; ģ

A:

=IF(G1="#1","This Equals 1",IF(G1="#3","This Equals 3",IF(G1="#5","This Equals 5",IF(G2="#1","This Equals 1",IF(G2="#3","This Equals 3",IF(G2="#5","This Equals 5",IF(G3="#1","This Equals 1",IF(G3="#3","This Equals 3",IF(G3="#5","This Equals 5",IF(G4="#1","This Equals 1",IF(G4="#3","This Equals 3",IF(G4="#5","This Equals 5"))))))))))))

B:

=IF(G1="#2","This Equals 2",IF(G1="#4","This Equals 4",IF(G1="#6","This Equals 6",IF(G2="#2","This Equals 2",IF(G2="#4","This Equals 4",IF(G2="#6","This Equals 6",IF(G3="#2","This Equals 2",IF(G3="#4","This Equals 4",IF(G3="#6","This Equals 6",IF(G4="#2","This Equals 2",IF(G4="#4","This Equals 4",IF(G4="#6","This Equals 6"))))))))))))

C:

=IF(G1="#7","This Equals 7",IF(G1="#8","This Equals 8",IF(G1="#9","This Equals 9",IF(G2="#7","This Equals 7",IF(G2="#8","This Equals 8",IF(G2="#9","This Equals 9",IF(G3="#7","This Equals 7",IF(G3="#8","This Equals 8",IF(G3="#9","This Equals 9",IF(G4="#7","This Equals 7",IF(G4="#8","This Equals 8",IF(G4="#9","This Equals 9"))))))))))))

这些是当前的结果:1 它应该如下所示:2

列G上添加数字的顺序并不重要,但仍应填充下一个可用单元格。 也许这不能用excel公式完成?这就是我想要弄清楚的。如果我提出的问题有意义或需要进一步澄清,请告诉我。

基本上,"#"代表代码/产品编号,3列代表类别。

1 个答案:

答案 0 :(得分:0)

A1:

fxLayoutAlign.xs="start stretch"

B1:

=IFERROR("This Equals " & SUBSTITUTE(INDEX($G:$G,AGGREGATE(15,6,ROW($G$1:$G$4)/(($G$1:$G$4="#1")+($G$1:$G$4="#3")+($G$1:$G$4="#5")),ROW(1:1))),"#",""),"")

C1:

=IFERROR("This Equals " & SUBSTITUTE(INDEX($G:$G,AGGREGATE(15,6,ROW($G$1:$G$4)/(($G$1:$G$4="#2")+($G$1:$G$4="#4")+($G$1:$G$4="#6")),ROW(1:1))),"#",""),"")

然后将这些公式复制下来。

enter image description here