Videos
My job requires me to track my time in various categories, and I round up to the nearest .25 of an hour. Because I jump from task to task throughout the day, I use an Excel sheet to track my time. For each time entry, I plug in:
Date
Start time
Stop time
Billing category
Brief description
Excel automatically calculates the number of minutes I spent on a task and converts that to a decimal.
I have a pivot chart that is organized as follows:
Date - total amount of time billed during the day
Billing category - total amount of time billed during the day to this category
Each individual time entry (description, amount of time billed)
I'm looking for the sum of the bolded item above to be rounded up to the nearest .25. I know that I can use =CEILING.MATH(CELL, .25) in a regular spreadsheet, but I don't know how to do it in a pivot chart. And I don't want to round up each individual time entry in my spreadsheet, because it could automatically inflate the time. (Imagine I spent .08 of an hour billing to ACME Co. and then later in the day I bill another .08 of a hour to ACME. If I round each individual entry, I'd end up billing .5 (.08 rounded to .25 x 2) when in reality I should bill .25 (.08 x 2 = .16 rounded to .25.).)
My pivot table fields are currently:
Rows:
Date
Billing Category
Description
And the Value is
Sum of "Time in decimals" field
I don't know of any python function to do so, but you can easily code one :
import math
def ceil(x, s):
return s * math.ceil(float(x)/s)
The conversion to float is necessary in python 2 to avoid the integer division if both arguments are integers. You can also use from __future__ import division. This is not needed with python 3.
What you can do is this.
ceil = lambda x,y: math.ceil(x*(1.0/y))/(1.0/y)
But it is not foolproof.
