Nested IF gone wrong

Tomkat

New Member
Joined
Mar 27, 2009
Messages
20
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")))

Thanks in advance.
 

Some videos you may like

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"

SydneyGeek

MrExcel MVP
Joined
Aug 5, 2003
Messages
12,251
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
 

konew1

Well-known Member
Joined
Oct 17, 2007
Messages
2,287
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
Joined
Mar 27, 2009
Messages
20

ADVERTISEMENT

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
Joined
Oct 17, 2007
Messages
2,287
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")))
 

Watch MrExcel Video

Forum statistics

Threads
1,122,601
Messages
5,597,117
Members
414,126
Latest member
jellevansoelen

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
Top