Found a solution.

=SUMIF(sheet 1'!C:C,"company 1",'sheet 1'!M:M)+SUM(F:F). This gives me the correct value.