Formula help nesting 3 if statements

Stryker2013

New Member
Joined
Jul 22, 2013
Messages
40
I have a spread sheet which tracks weekly logged work hours. I total the days to a weekly total. I want that total to compare to a 40 hr week and be reflected in a billed column. I have three if statements I need to work. 1st if is the 40 hr worked is equal to my standard week of 40 hrs the displays a 0. The standard 40 hrs is in Cell H1 and formatted as 40:00. The second if statement is to compare the week and if it is more than 40 hrs display the overage as a positive number. The 3rd if statement is to compare the week and if it is less than 40 hr display the number as a negative number. the formula I have right now partially works for the 1st two if's but the negative displayed number is not working. ALl i get is a long string of ###########.

1st attempt i have 40 in weekly total and a 40 in H1 the formula works in displaying a 0:00
=IF(E7>$H$1,(E7-$H$1),IF(E7<$<wbr>H$1,($H$1-H7),0))

2nd attempt i modified 40:30 in the weekly total and 40 in H1 the formula works in displaying 0:30
=IF(E14>$H$1,(E14-$H$1),IF(<wbr>E14<$H$1,($H$1-E14),0))

3rd attempt fails when I modified it to 36:30 in the weekly total and 40 hr in H1 all I get is #########
=IF(E21>$H$1,(E21-$H$1),IF(<wbr>E21<$H$1,(-1*($H$1-E21)),IF(<wbr>E21=H1,0)))


Any ideas?
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
Hey Stryker,

It's a formatting issue. Excel displays negative dates and times as ########. My advice would be to change the format to "General" or "Number" and use "40" instead of "40:00". Your formula would only need to be this:

=E7-$H$1
 
Upvote 0
Good Morning. Perfect this worked. Changing to 1904 allows the display to be a negative number. Thank you so much
 
Upvote 0

Forum statistics

Threads
1,216,105
Messages
6,128,859
Members
449,472
Latest member
ebc9

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top