作爲一名前程序員,我喜歡乾淨,可維護和文檔化的代碼。在Excel中清潔代碼?
作爲一名項目經理,我不得不復雜的擅長不時,並希望寫我寫程序的「乾淨」公式。
(如何)我可以添加 「意見」 爲(多)的公式?
(How)我可以「命名」(細胞相關)公式並重用它嗎? (例如,它寫的VB(或參數甚至F#)函數)
例1:代替
=IF(AND(L$11+(L$13-1)*7>=$C15;L$11+(L$13-1)*7<$D15);VLOOKUP($A15;RessourcePlan;12+$E15;WRONG);0)
我想寫:
// check if this columns (L) date is inbetween startdate (Col C) and enddate (Col D)
=IF (AND(L$11+(L$13-1)*7>=$C15;L$11+(L$13-1)*7<$D15);
// then select the the utilisation (12+E15) for the resp. team from the resource plan
VLOOKUP($A15;RessourcePlan;12+$E15;WRONG);
// else default to 0
0
) //ENDIF
,而是example1我可能會寫一個用戶自定義函數(UDF)
Function Utilization(thisDate As Date, task As String) As Double
... // clean VB or F# code
End Function
然後寫
=Utilization(L11,A15)
「將」註釋「添加到(多行)公式中」在我看來,與「清潔」相反。 – pnuts 2015-02-06 14:49:00
恕我直言,它比複雜的oneliner更好,它的意義/內部工作原理在寫作後幾天我不記得了。我添加一個例子... – Bastl 2015-02-06 16:26:50
你有沒有嘗試過使用.net的excel互操作? – mydogisbox 2015-02-06 17:49:07