Round Up and Round Down based on certain decimal in a single formula

slothmgr

New Member
Joined
Feb 22, 2022
Messages
2
Office Version
  1. 365
Platform
  1. Windows
Hi, first of all I am sorry if my question (and its answer) has been posted here. Please kindly direct me to the post if it's already answered. And I'm sorry if my explanation is hard to understand.

So I'm working on a data of employee's working hours by hour. And I want if the working hours of them is bigger than or equal to XX:40, then it's rounded up. And if it's less than XX:40, then it's rounded down.


For example,
Working hours 7:40 ー> 8:00
Working hours 6:39 ー> 6:00

I was thinking of to convert the hours to number format, so any decimal number bigger than decimal of xx.67 (xx:40) it should be rounded up, and if it's less than xx.67 (xx:40) it should be rounded down. But then I don't how to set the limit of the xx.67. And should I combine it with IF function?


Is there anyway to solve this? Thank you in advance!
 

Attachments

  • Screenshot_20220222-222522_Excel.jpg
    Screenshot_20220222-222522_Excel.jpg
    91.9 KB · Views: 14
  • Screenshot_20220222-222522_Excel.jpg
    Screenshot_20220222-222522_Excel.jpg
    91.9 KB · Views: 15

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
MrExcelPlayground7.xlsx
AB
27:007:00
37:017:00
47:027:00
57:037:00
67:047:00
77:057:00
87:067:00
97:077:00
107:087:00
117:097:00
127:107:00
137:117:00
147:127:00
157:137:00
167:147:00
177:157:00
187:167:00
197:177:00
207:187:00
217:197:00
227:207:00
237:217:00
247:227:00
257:237:00
267:247:00
277:257:00
287:267:00
297:277:00
307:287:00
317:297:00
327:307:00
337:317:00
347:327:00
357:337:00
367:347:00
377:357:00
387:367:00
397:377:00
407:387:00
417:397:00
427:408:00
437:418:00
447:428:00
457:438:00
467:448:00
477:458:00
487:468:00
497:478:00
507:488:00
517:498:00
527:508:00
537:518:00
547:528:00
557:538:00
567:548:00
577:558:00
587:568:00
597:578:00
607:588:00
617:598:00
628:008:00
638:018:00
648:028:00
658:038:00
668:048:00
678:058:00
688:068:00
698:078:00
708:088:00
Sheet8
Cell Formulas
RangeFormula
B2:B70B2=TIME(HOUR(A2+20/60/24),0,0)
 
Upvote 0
Welcome to the Board!

If you want a numeric value (i.e. number of hours) and not a date/time returned, then for a time in cell A1, use this formula:
Excel Formula:
=HOUR(A1)+IF(MINUTE(A1)>=40,1,0)
and make sure the result is formatted as a number and not date/time.
 
Upvote 0
Solution
MrExcelPlayground7.xlsx
AB
27:007:00
37:017:00
47:027:00
57:037:00
67:047:00
77:057:00
87:067:00
97:077:00
107:087:00
117:097:00
127:107:00
137:117:00
147:127:00
157:137:00
167:147:00
177:157:00
187:167:00
197:177:00
207:187:00
217:197:00
227:207:00
237:217:00
247:227:00
257:237:00
267:247:00
277:257:00
287:267:00
297:277:00
307:287:00
317:297:00
327:307:00
337:317:00
347:327:00
357:337:00
367:347:00
377:357:00
387:367:00
397:377:00
407:387:00
417:397:00
427:408:00
437:418:00
447:428:00
457:438:00
467:448:00
477:458:00
487:468:00
497:478:00
507:488:00
517:498:00
527:508:00
537:518:00
547:528:00
557:538:00
567:548:00
577:558:00
587:568:00
597:578:00
607:588:00
617:598:00
628:008:00
638:018:00
648:028:00
658:038:00
668:048:00
678:058:00
688:068:00
698:078:00
708:088:00
Sheet8
Cell Formulas
RangeFormula
B2:B70B2=TIME(HOUR(A2+20/60/24),0,0)
Welcome to the Board!

If you want a numeric value (i.e. number of hours) and not a date/time returned, then for a time in cell A1, use this formula:
Excel Formula:
=HOUR(A1)+IF(MINUTE(A1)>=40,1,0)
and make sure the result is formatted as a number and not date/time.
Thank you for the warm welcoming words! :oops:

Thank you so much for both of you. They worked perfectly! Now I know how to round the time (with a certain limit) both in number-formatted and time-formatted.

I wish you two have a nice day!?
 
Upvote 0
You are welcome.
Glad we were able to help!
 
Upvote 0

Forum statistics

Threads
1,215,212
Messages
6,123,654
Members
449,113
Latest member
Hochanz

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