Find the difference between two cells

一世执手 提交于 2019-12-11 20:07:15

问题


Below is the example of my Excel sheet. In that I want to find the Gain and Loss using the E and D cells. If E>D it should calculate E-D and the value should be entered in F cell and if E


回答1:


Enter this formula into cell F2:

=IF(E2 > D2, E2 - D2, "-")

Then enter this formula into cell G2:

=IF(E2 <= D2, E2 - D2, "-")

For a row where something is not a gain or a loss, a - dash will appear in that column.




回答2:


Use the IF() Function.

In the GAIN column, try:

=IF(E2>D2, E2-D2, 0)

In the Loss column, try:

=IF(E2<D2, D2-E2, 0)


来源:https://stackoverflow.com/questions/32688178/find-the-difference-between-two-cells

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!