How to Round to nearest (up or down) 1/2 inside IF Formula?

lorne17

New Member
Joined
Mar 28, 2017
Messages
15
Is there a way to round this formula to nearest .5 decimal with the IF formula I have? I can get it working, but when "PAST" or "NO HRS" comes out of the formula, I then try to devide and multiple and get the #VALUE! error.


How can I round this and still get the "PAST" or "NO HRS" when the IF portion of the formula comes true?


=ROUND(IF(L$4<today(),"past",if(and(l$4>=$C$13,L$4<=$C$14),$Q22/$C$26,IF(AND(L$4>=$D$13,L$4<=$D$14),$Q30/$C$34,IF(AND(L$4>=$E$13,L$4<=$E$14),$Q38/$C$42,IF(AND(L$4>=$F$13,L$4<=$F$14),$Q38/$C$42,IF(AND(L$4>=$G$13,L$4<=$G$14),$Q46/$C$50,IF(AND(L$4>=$H$13,L$4<=$H$14),$Q54/$C$58,"NO HRS")))))))/0.5,0)*0.5


Thanks in advance,
Lorne</today(),"past",if(and(l$4>
 
That second line used to say

IF(D$4=$C$13,D$4<=$C$14),$Q22/$C$26,

That's where you were missing the AND.
 
Upvote 0

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
That second line used to say

IF(D$4=$C$13,D$4<=$C$14),$Q22/$C$26,

That's where you were missing the AND.

I don't meant to keep repeating myself, but my first three posts were not showing the formula that I copied and pasted correctly. Please refer to my latest post that has an image in the message. That's the current state of my formula that is not functioning.

Thanks,
Lorne
 
Upvote 0
How about ...

Code:
=IF(D$4 < TODAY(), "PAST",
 IFERROR(MROUND(
    IF(AND(D$4 = $C$13,  D$4 <= $C$14), $Q22/$C$26,
    IF(AND(D$4 >= $D$13, D$4 <= $D$14), $Q30/$C$34,
    IF(AND(D$4 >= $E$13, D$4 <= $E$14), $Q38/$C$42,
    IF(AND(D$4 >= $F$13, D$4 <= $F$14), $Q38/$C$42,
    IF(AND(D$4 >= $G$13, D$4 <= $G$14), $Q46/$C$50,
    IF(AND(D$4 >= $H$13, D$4 <= $H$14), $Q54/$C$58)))))), 0.5),"NO HRS"))
 
Upvote 0
How about ...

Code:
=IF(D$4 < TODAY(), "PAST",
 IFERROR(MROUND(
    IF(AND(D$4 = $C$13,  D$4 <= $C$14), $Q22/$C$26,
    IF(AND(D$4 >= $D$13, D$4 <= $D$14), $Q30/$C$34,
    IF(AND(D$4 >= $E$13, D$4 <= $E$14), $Q38/$C$42,
    IF(AND(D$4 >= $F$13, D$4 <= $F$14), $Q38/$C$42,
    IF(AND(D$4 >= $G$13, D$4 <= $G$14), $Q46/$C$50,
    IF(AND(D$4 >= $H$13, D$4 <= $H$14), $Q54/$C$58)))))), 0.5),"NO HRS"))

That's it! Thank you!
 
Upvote 0

Forum statistics

Threads
1,215,103
Messages
6,123,103
Members
449,096
Latest member
provoking

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