A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
If you want to implement it exactly like that, you need VBA and depending on the exact circumstances in your file, it can be more or less complex.
A very simple way is to use the data as in your screenshot as input and get the results in the next columns.
In J5: =H5*IF(G5="-",-1,1)
In K5: =I5*IF(G5="-",-1,1)
Andreas.