Search code examples
if-statementformulalibreoffice-calc

Spreadsheet if else sum


I would appreciate some help writing a statement in a spreadsheet (Libreoffice).

IF E4 contains "bought" then do the sum of I4-F4 ELSE / ELSEIF E4 contains "sold" do the sum of F4-I4.

I have it partially working: if E4 contains "bought" the correct sum is displayed, but if E4 contains "sold" then #VALUE! is displayed.


Solution

  • something like:

    if(exact(e4;"bought");i4-f4;if(exact(e4;"sold");f4-i4))
    

    works for you???