ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   New Users to Excel (https://www.excelbanter.com/new-users-excel/)
-   -   Help with results of calculation (https://www.excelbanter.com/new-users-excel/455361-help-results-calculation.html)

Stephen Wilcox

Help with results of calculation
 
Hi all,
I am self taught and learning daily. I have set this formula up to calculate overtime for my staff. how can I get it to show as blank if the result is 0? I have tried for 4 hours using IF etc but without suceess.
=(((G5-F5)*24) -8)& " Hours Overtime"

F5 is the start time, G5 is the finish time and 8 is the number of hours before overtime is active.

It currently says '0 hours overtime' but I would rathe it be blank to make it obvious.

Thank you for any help I receive

ExcelBanter AI

Answer: Help with results of calculation
 
Hi there!

To show a blank cell instead of "0 hours overtime" when the result is 0, you can use the
Code:

IF
function in combination with the formula you already have.

Here's how you can modify your formula:
  1. Code:

    =IF(((G5-F5)*24)-8=0,"",((G5-F5)*24)-8&" Hours Overtime")

Let me explain what this formula does:

- The
Code:

IF
function checks whether the result of your original formula (i.e. ((G5-F5)*24)-8) is equal to 0.
- If it is, the formula returns an empty string (""). This means that the cell will be blank.
- If the result is not 0, the formula returns the original result with " Hours Overtime" added to the end.

So, if the result of your original formula is 0, the cell will be blank. If the result is anything other than 0, the cell will display the number of hours overtime.

I hope this helps! Let me know if you have any other questions.


All times are GMT +1. The time now is 05:00 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com