I\'ve an excel spreadsheet with a column which has the date and time of a particular event. I would like to round this to the nearest 15 minute interval so that I can count
If you want to round to the Nearest 15:
Assuming your time is in cell A2
We'll put our new time into B2:
B2 =TIME(HOUR(A2), ROUND((MINUTE(A2)/60)*4, 0) * 15, 0)
If you wanted to always round up or down you replace ROUND with ROUNDUP or ROUNDDOWN
simple:
Where A1 is the difference between the two time. It can be a reference or calculations:
=CEILING(C2-B2,"00:15")
, where C2 is the end time and B2 is the start time.
Date and time rounded to nearest 15-minute period (you can always round up/round down using something like INT):
=DATE(YEAR(B1),MONTH(B1),DAY(B1))+TIME(HOUR(B1), ROUND(MINUTE(B1)/15,0)*15, 0)
Assuming cell B1 contains the date time to be rounded. This will return the number in typical serial date fashion (e.g. 39846.64444 = 02/02/2009 15:28) and you need to format your result cell as a date/time to see the value (as with all solutions to this problem). Showing date and time together is not a standard Date or Time format, you need a Custom format to do this.
Since you said you also want the date, how about this:
= (ROUND((A1 * 1440) / 15, 0) * 15) / 1440
Assuming that A1 has the date/time value you want. This takes advantage of the fact that date/time columns in Excel are just numbers (integer portion is the date, fractional portion is the time)
Assuming you have 2 date-times and you want to find the total and round up to the nearest 15 minutes:
A1 = 7/10/2014 16:10
A2 = 7/10/2014 17:49
First get the total in decimal hours:
A3: =(A2-A1)*24
Then you can round up to the nearest quarter hour:
A4: =Ceiling(A3, .25)
Or do it all on one cell:
A3: =Ceiling((A2-A1)*24, .25)
Keep it simple. Rounds to the closest 15 minute interval.
= ROUND(B2 * 24 * 4, 0) / 4 / 24