How do i roundup minutes to nearest hour (< 30 or >30 min) withou.

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I want to roundup the time format (hh:mm:ss) in a column to nearest hour.
Nearest hour needs to be based on minutes less than or greater than 30 min.
So that a column with (2003-05-23 17:33:36.000000) in text format needs to be
converted to date/time format and rounded to (2003-05-23 18:00) since it is
more than 30 minutes. Is this possible?
Any help will be highly appreciated!!
Thanks in advance
 
Try something like this:

DateAdd("h",
CLng(DateDiff("n", #0:00:00#, TimeValue([d])) / 60),
DateValue([d]))

where "d" represents the name of your date column.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top