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

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
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

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

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.

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.

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")))

That worked! Thank you somuch.

Kat

Replies
1
Views
196
Replies
4
Views
285
Replies
1
Views
133
Replies
1
Views
288
Replies
5
Views
217

1,203,182
Messages
6,053,974
Members
444,695
Latest member
asiaciara

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?

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

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