【发布时间】:2017-10-07 09:06:57
【问题描述】:
伙计们,
我已经设法仅使用 excel 公式创建了一个动态的、多级的、编号的列表。这工作正常,我想我会分享结果。我唯一的问题是,如果有人想接受这个并尝试简化它。我似乎无法上传示例表(第一次发布)。
编辑 我正在使用一个名为 tbOOA 的表,它有 2 列,选择级别和结果。要使用公式,请复制下面不以 > 开头的编码部分的每一行,并将其复制到一个(长)论坛中。
想要的结果: 结果 1
输出 1.1
活动 1.1.1
活动 1.1.2
输出 1.2
活动 1.2.1
结果 2
输出 2.1
活动 2.1.1 等
>The formula explained:
>First choose if it is an Outcome, Output or Activity. If blank, then nothing
=IF([@[Choose Level]]="","",
>If it is an Outcome, put the word "Outcome" into column C
IF([@[Choose Level]]="Outcome", "Outcome " &
>and concatenate it with a count of the number of "Outcome" already chosen, limited from the header of the table, until this row
COUNTIF(tbOOA[[#Headers],[Choose Level]]:[@[Choose Level]], [@[Choose Level]]),
>Else, if "Output" is chosen, put the word "Output"
IF([@[Choose Level]]="Output", "Output "&
>and concatenate it with the number of "Outcome" from the table header to this line
COUNTIF(tbOOA[[#Headers],[Choose Level]]:[@[Choose Level]],"Outcome")
>and concatentate it with a dot and then
&"."&
>(This was the difficult part of the formula)
>count how many instances of "Output" there are between the last (most recent) instance of "Outcome" and the current row
COUNTIF(INDIRECT(ADDRESS(SUMPRODUCT(MAX(ROW(tbOOA[[#Headers],[Choose Level]]:[@[Choose Level]])*(tbOOA[[#Headers],[Choose Level]]:[@[Choose Level]]="Outcome"))),COLUMN([@[Choose Level]]))&":"&ADDRESS(ROW([@[Choose Level]]),COLUMN(([@[Choose Level]]))),TRUE),"Output"),
>Else, it must be an "Activity", so put "Activity"
"Activity " &
>and concatenate with the number of "Outcome" from table header to this row, and dot
COUNTIF(tbOOA[[#Headers],[Choose Level]]:[@[Choose Level]],"Outcome")&"."&
>and count how many instances of "Output" between the last "Outcome" and this line
COUNTIF(INDIRECT(ADDRESS(SUMPRODUCT(MAX(ROW(tbOOA[[#Headers],[Choose Level]]:[@[Choose Level]])*(tbOOA[[#Headers],[Choose Level]]:[@[Choose Level]]="Outcome"))),COLUMN([@[Choose Level]]))&":"&ADDRESS(ROW([@[Choose Level]]),COLUMN(([@[Choose Level]]))),TRUE),"Output")&"."&
>and finally, count how many instances of "Activity" since the last "Output"
ROW([@[Choose Level]])-SUMPRODUCT(MAX(ROW(tbOOA[[#Headers],[Choose Level]]:[@[Choose Level]])*(tbOOA[[#Headers],[Choose Level]]:[@[Choose Level]]="Output"))))))
【问题讨论】:
-
ChooseLevel 列中可能有哪些条目?
-
“结果”、“输出”和“活动”
-
除非我把“结果”放在表格的第一个单元格中,否则我到处都会出错。我可以将其他两个值放在第一个值以下的单元格中,但不能放在第一个值中。你能澄清一下吗?
-
同意。这是一个小错误。但从逻辑上讲,从商业角度来看,结果永远是第一位的。我可以在其中添加一个额外的错误处理 IF 语句。
-
ChooseLevel 列中的条目顺序有哪些限制?例如,如果前三个单元格是“Outcome”、“Activity”、“Activity”,我会得到“Outcome1”、“Activity1.0.3”、“Activity1.0.4”。对吗?
标签: excel dynamic multi-level numbered-list