How to rewrite excel formulas in a readable manner?

前端 未结 9 2577
萌比男神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:27

    You can simplify your formula substantially while still keeping a single formula. You are repeating almost the same expression 4 times with the HEX2DEC/VLOOKUP part, that can be reduced to a single instance if you recognise that this

    =IF(formula<0,0,formula)

    .....is equivalent to

    =MAX(0,formula)

    [for numeric results of formula]

    and if you nest your IF(D17="".....expression within the main formula, i.e. this version

    =IF(ISERROR(G16&G17),X16,IF(OR(G16={"xxx","yyy","zzz"}), Y16,IF(G16="333","N\A",IF(G17="333",Z16,MAX(0,(HEX2DEC(IF(D17="",W$10,W17))-HEX2DEC(W16))/VLOOKUP(F16,$M$36:$N$41,2,0))))))

提交回复
热议问题