# Nested IF gone wrong

#### Tomkat

##### New Member
If anyone can help me with this it would be greatly appreciated. I am using the following formula to determine if an employee has worked their required hours for the month to show "Nil", if they have worked less than one extra day (7hrs) "Hours", or if they have worked more than an extra 7 hours "Days". It is working fine except that I have one person that has worked their exact hours but it shows "Days" instead of Nil. I figure this is because it is set up in custom hours [h]:mm but I can't work out how to correct this. Have tried entering 0:00 in my formula.

=IF(c28=0,"Nil",IF(C28>7,"Days",IF(C28<7,"Hours")))

### Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).

#### SydneyGeek

##### MrExcel MVP
If a value of 7 in C28 should give you "Nil", try this:

=IF(OR(c28=0,c28=7),"Nil",IF(C28>7,"Days",IF(C28<7,"Hours")))

Denis

#### Tomkat

##### New Member
Thanks, tried that formula but it gave me an error message.

#### konew1

##### Well-known Member
What is in C28? Are you sure it contaoins the value 7? If you are getting a result from other calculations (especially time calculations) the chances are you have a value with a small decimal component.

#### Tomkat

##### New Member
C28 has 0.0. This is part of a timesheet summary so the hours have been set up as custom [h]:mm. I have tried converting this to another format but still cannot get it to work.

#### konew1

##### Well-known Member
If you have tried the suggestion posted by Sydneygeek then C28 cannot contain exactly zero.
Try to format C28 as a regular numeric format style with several decimal places and I think you will find it does not contain zero. The solution might be to use ROUND function in your IF formula. Something like below, but you must change the rounding factor to what is appropriate for your work - I put in "3" as a starting point.
=IF(OR(Round(c28,3)=0,Round(c28,3)=7),"Nil",IF(C28>7,"Days",IF(C28<7,"Hours")))

#### Tomkat

##### New Member
That worked! Thank you somuch.

Kat

Replies
3
Views
713
Replies
5
Views
325
Replies
3
Views
303
Replies
4
Views
453
Replies
1
Views
256

1,172,041
Messages
5,878,862
Members
433,380
Latest member

### 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.

### Which adblocker are you using?

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

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