Page 1 of 1

[Solved] Subtract, but prevent negative result

Posted: Fri Nov 08, 2024 12:58 am
by manicmailman
Novice LibreOffice user here looking for some help on how to do conditional subtraction. I have a spreadsheet of workhours for a week, and I want to make a formula that will take the raw workhours and subtract 11.50 to find total hours worked past the hourly limit of 11.50, but will ignore the function (or else zero it out) if they worked less than 11.50. Any help is appreciated!

Re: Raw Subtract If and conditional subtraction

Posted: Fri Nov 08, 2024 1:10 am
by FJCC
If your raw hours are in B2, this formula should work.

Code: Select all

=MAX(0;B2 - 11.5)
You will get zero if B2 is less than 11.5.

Re: Raw Subtract If and conditional subtraction

Posted: Fri Nov 08, 2024 1:14 am
by manicmailman
Works like a charm! Thanks a lot!

Re: Raw Subtract If and conditional subtraction

Posted: Fri Nov 08, 2024 1:15 am
by robleyd
Or you could use IF():

Code: Select all

=IF(B2 < 11.5; 0; B2 - 11.5)