我已經成功地創建一個動態的,多層次的,只有使用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列中可能的條目是什麼? –
'結果','輸出'和'活動' –
除非我在表中的第一個單元格中放置「結果」,否則我會遇到任何錯誤。我可以將其他兩個值放在第一個值以下的單元格中,但不是第一個。你能澄清嗎? –