I need some math for a formula to do the following:
User inputs the:
number of hours sleep they want
time they want to wake up
I return the time they need to go to bed.
I am using a calculator plug in that does not have any time functions. So if wake up time is 8 and they want 14 hours sleep I get a -6. Any thoughts on the formual to use so -6 would be 18:00?
Solved! Solved! Go to Solution.
Welcome to the Github Community Forum!
The basic formula is this gbt = (24 - hts + wut) module 24, with: gbt the go bed time, hts the hours the user want to sleep and wut the wake up time.
In your example will be something like this:
wake_up_time = userInput() = 8 hours_to_sleep = userInput() = 14 go_bed_time = (24 - hours_to_sleep + wake_up_time) mod 24 = (24 - 14 + 8) mod 24 = 18 mod 24 = 18
Hope to solve your problem, ask if have more question :)
Mark helpfull posts with Accept as Solution to help other users locate important info. Don't forget to give Kudos for great contents!
Hi, @JCA2626 ,, also using Excel this can be solved.
Formula in Cell L 41:
Formula in N39:
Final Formula in Cell L43:
Hope this help you.