I am creating a form for staff to enter in the actual hours and minutes that they spend with a client each ses
sion and I cannot figure out how to get the time to add up correctly. I am looking for minutes not fractions of minutes.
Example: Sarah sat with Joey for 1 hour and 25 minutes and sat with Jill for 30 minutes - must add up as 1:55
I have searched the web many times and can find nothing. Does anyone have any suggestions?
Solved! Go to Solution.
Views
Replies
Total Likes
Write code that changes everythig to a common unit (i.e. minutes). Then you can add them up and get a total number of minutes. Then finally you can divide by 60 to get the hours and the reminder will be the number of minutes you have. So if you end up with 183 minutes you woudl have 3 hrs and 3 mins.
Make sense?
Paul
Views
Replies
Total Likes
Write code that changes everythig to a common unit (i.e. minutes). Then you can add them up and get a total number of minutes. Then finally you can divide by 60 to get the hours and the reminder will be the number of minutes you have. So if you end up with 183 minutes you woudl have 3 hrs and 3 mins.
Make sense?
Paul
Views
Replies
Total Likes
Yes, it does thank you. Can I make a subform that will do the calculations behind the scenes so it is not on the form? If so, how? I know how to create a subform but all the intricate workings of one is a mystery to me at this time.
Views
Replies
Total Likes
Paul,
I ran across this OLD thread while researching a problem and hoped you could expand just a bit.
I am trying to add hours and minutes, just as above. However, I report everything in fifteen minute increments.
Example: 1.15 = one hour fifteen minutes
1.30 = one hour thirty minutes
When I add as you suggested, I get 165 minutes / 60 = 2.75 hours. I need this answer to display as 2.45 (two hours and 45 minutes). If I add these with normal math, the above problem works correctly, but the answer doesn't compute correctly with other time variables:
Example: 1.30 + 1.30 = 2.60 instead of 2 hours.
any ideas on how I can add these in 15 minute increments?
thanks!
Gene-O
Views
Replies
Total Likes
Paul is no longer around.
Views
Replies
Total Likes
Hello Gene-O
Don't take this the wrong way.... buuuut your problem is in your math. 1.15 is not equal to 1 hour and 15 minutes. 1.25 is equal to 1 hour 15 minutes. 165/60 does equal 2.75 hours.
You are trying to get this type of time: 1:15 (1 hour 15 minutes - notice the colon)
You actually have to do a conversion and then re-convert it back to
I have a form with columns of time in this format HH:MM (hours are seperate column & minutes are a seperate column.)
var dMin = Page1TotalMinutes (Page1TotalMinutes is a seperate formula in a different cell in the table)
var dHrs = Round (dMin / 60, 2)
dMin = Round( Mod(dHrs, 1) * 60)
$.formattedValue = Concat(dHrs, ":", dMin)
if (dMin <=9) then
$.formattedValue = Concat(dHrs, ":0", dMin)
elseif (dMin >=10) then
$.formattedValue = Concat(dHrs, ":", dMin)
endif
If you didn't want to use multiple cells for your formula, I could've made my Page1TotalMinutes another variable in the above code like this
var Page1TotalMinutes = sum (HoursTotal1 + MinutesTotalPage1) (But again I have HoursTotal1 & MinutesTotalPage1 in different cells that could be made into yet another variable like I did above)
Message was edited by: JillOfAllTrades72 @3:15 on 9/11/13
Views
Replies
Total Likes
Views
Likes
Replies