How to rewrite excel formulas in a readable manner?

前端 未结 9 2572
萌比男神i
萌比男神i 2021-02-13 02:53

I have an Excel file with formulas in this manner:

=IF(OR(ISERROR(G16),ISERROR(G17)),X16,IF(OR(G16=\"xxx\",G16=\"yyy\",G16=\"zzz\"),Y16,IF(G16=\"333\",\"N\\A\",IF(

9条回答
  •  盖世英雄少女心
    2021-02-13 03:14

    As an example using helper columns, you could shorten the formula with the following

    [A1] =VLOOKUP(F16,$M$36:$N$41,2,FALSE)

    [B1] =HEX2DEC(W$10)

    [C1] =HEX2DEC(W16)

    [D1] =HEX2DEC(W17)

    then the large formula is shortened to

    =IF(OR(ISERROR(G16),ISERROR(G17)),X16,IF(OR(G16="xxx",G16="yyy",G16="zzz"),Y16,IF(G16="333","N\A",IF(G17="333",Z16,IF(D17="",IF((B1-C1)/A1<0,0,(B1-C1)/A1), IF((D1-C1)/A1<0,0,(D1-C1)/A1))))))

    This is particularly effective when using volatile functions such as DATE or NOW which you don't want to recalc for every cell when it's the same result.

    Whether it's more readable, perhaps not but you can label column headings with appropriate comments

提交回复
热议问题