Search code examples
excelexcel-formulaexcel-2010excel-2007

Find the difference between two cells


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


Solution

  • 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.