Find the difference between two cells

2019-08-30 04:07发布

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

enter image description here

2条回答
ら.Afraid
2楼-- · 2019-08-30 04:33

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)
查看更多
乱世女痞
3楼-- · 2019-08-30 04:38

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.

查看更多
登录 后发表回答