Need some help with yet another rounding issue. The data in bold are the only two pieces of data I have given to me. This in red are calculated through a series of queries.
StartDate = 06/09/08
EndDate = 08/01/08
Weeks = 8
TotalDays = 54
TotalWeeks = (54/7) = 7.71
Month1Days = 22
Month2Days = 31
Month3Days = 1
Month4Days = 0
Month5Days = 0
Month1Weeks = 22/7 = 3.14
Month2Weeks = 31/7 = 4.43
Month3Weeks = 1/7 = 0.14
Month4Weeks = 0/7 = 0.00
Month5Weeks = 0/7 = 0.00
Need to get one of the following results.
CORRECTION
Month1WksRounded = 4.00
Month2WksRounded = 4.00
Month3WksRounded = 0.00
Month4WksRounded = 0.00
Month5WksRounded = 0.00
TotalWksRounded = 8.00
I tried the nearest half function (Int(sValue * 2 + 0.5) / 2) that I found in this forum and ran into a problem when I had a value less than 0.5. I am guessing that the function would round up, for any value greater than 0.5. If value 0.00 - 0.49 should round down.
As you can see by the time on this posting, I am stuck and will try again in the morning. Any assistance would be greatly appreciated.
StartDate = 06/09/08
EndDate = 08/01/08
Weeks = 8
TotalDays = 54
TotalWeeks = (54/7) = 7.71
Month1Days = 22
Month2Days = 31
Month3Days = 1
Month4Days = 0
Month5Days = 0
Month1Weeks = 22/7 = 3.14
Month2Weeks = 31/7 = 4.43
Month3Weeks = 1/7 = 0.14
Month4Weeks = 0/7 = 0.00
Month5Weeks = 0/7 = 0.00
Need to get one of the following results.
CORRECTION
Month1WksRounded = 4.00
Month2WksRounded = 4.00
Month3WksRounded = 0.00
Month4WksRounded = 0.00
Month5WksRounded = 0.00
TotalWksRounded = 8.00
I tried the nearest half function (Int(sValue * 2 + 0.5) / 2) that I found in this forum and ran into a problem when I had a value less than 0.5. I am guessing that the function would round up, for any value greater than 0.5. If value 0.00 - 0.49 should round down.
As you can see by the time on this posting, I am stuck and will try again in the morning. Any assistance would be greatly appreciated.
Last edited: