如何以可读方式重写excel公式? [英] How to rewrite excel formulas in a readable manner?

查看:125
本文介绍了如何以可读方式重写excel公式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



= 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((HEX2DEC(W 10 $)-HEX2DEC(W16))/ VLOOKUP(F16,$ M $ 36:$ N $ 41,2,FALSE)< 0,0,(HEX2DEC( (F16,$ M $ 36:$ N $ 41,2,FALSE)),IF((HEX2DEC(W17)-HEX2DEC(W16))/ VLOOKUP(F16,$ M $ 36: $ N $ 41,2,FALSE)< 0,0,(HEX2DEC(W17)-HEX2DEC(W16))/ VLOOKUP(F16,$ M $ 36:$ N $ 41,2,FALSE)))))))



我想简化它们,以便以更可读的方式写入。




  • 我可以以缩进的方式编辑/写Excel公式吗?

  • 我可以做些什么简化?

  • 我应该使用VBA脚本而不是Excel的公式吗?


解决方案

作为使用帮助列的示例,您可以使用以下

缩短公式

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



[B1] = HEX2DEC(W $ 10) code>



[C1] = HEX2DEC(W16)



[D1] = HEX2DEC(W17)



那么大公式被缩短为



= IF(OR(ISERROR(G16),ISERROR(G17)),X16,IF(OR(G16 =xxx 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))))))



当使用诸如DATE或NOW之类的易失性函数时,这是非常有效的,当您的结果相同时,您不想为每个单元格重新计算。



无论是更易读,也许不是标签栏目具有适当注释的


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(G17="333",Z16,IF(D17="",IF((HEX2DEC(W$10)-HEX2DEC(W16))/VLOOKUP(F16,$M$36:$N$41,2,FALSE)<0,0,(HEX2DEC(W$10)-HEX2DEC(W16))/VLOOKUP(F16,$M$36:$N$41,2,FALSE)), IF((HEX2DEC(W17)-HEX2DEC(W16))/VLOOKUP(F16,$M$36:$N$41,2,FALSE)<0,0,(HEX2DEC(W17)-HEX2DEC(W16))/VLOOKUP(F16,$M$36:$N$41,2,FALSE)))))))

I would like to simplify them so it will be written in a more readable manner.

  • Can I edit/write Excel formulas in indented way?
  • What kind of simplifications can I do?
  • Should I use an VBA script instead of Excel's formulas?

解决方案

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

这篇关于如何以可读方式重写excel公式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆