0

CEILING in Excel =CEILING(E2,6)/60 for calculating legal billable hours in 6 min increments from minutes (1 min = 0.1, 5 min = 0.1, 7 min = 0.2 etc) when transposed to JS with the CEIL function as: var legal = Math.ceil(total_time, 6) / 6 where total_time is (date_end - date_start) / 60000 and date_end and date_start field values in ms does not work when values are for eg. 2 min --> 0.2

Inputed values do not provide CEILING in 6 min increments as in Excel, other than values such as 30 min = 0.5

4
  • Sorry, it's really unclear what you asking here. Could you give some example data, and expected output, it might help clarify what your trying to do. ps. 6 min is 6 * 1000 * 60 = 360000, and not 60000 Commented Jul 3, 2023 at 21:11
  • Also Math.ceil does not have a second argument,you will need to multiply and divide by 6 to have the same as Excell. eg. Math.ceil(n * 6) / 6 Commented Jul 3, 2023 at 21:17
  • function ceiling(number, significance) { return Math.ceil(number / significance) * significance; } from stackoverflow.com/questions/49262842/… Commented Jul 3, 2023 at 22:48
  • 1
    Output expected: 1-6 = .1, 7-12 = .2, 13-18 = .3, 19-24 = .4, 25-30 = .5, 31-36 = .6, 37-42 = .7, 43-48 = .8, 49-54 = .9, 55-60 = 1.0 Commented Jul 3, 2023 at 22:50

1 Answer 1

0

Answer: return Math.ceil(n/6.0) / 10;

Sign up to request clarification or add additional context in comments.

1 Comment

As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.