+ Reply to Thread
Results 1 to 3 of 3

Prevent Clng from dropping Time off returned Serial value

  1. #1
    Forum Contributor
    Join Date
    12-10-2008
    Location
    Austin
    Posts
    660

    Prevent Clng from dropping Time off returned Serial value

    I'm really struggling with this.

    In a cell I have a date in the format as : 3/23/2012 10:22AM

    I would like to compare this to another date and time so I'm thinking I need to convert it to a serial number.

    I'm trying to use Clng to convert the date w/time , to a decimal numerical value. However, everything to the right of the decimal is being dropped off, thus removin the time(fraction) part of the value.
    IE: Instead of returning someting like 40877.52457, I'm getting 40877 returned.

    Please Login or Register  to view this content.
    Any help is appreciated.

    Thanks,

    BDB
    Last edited by bdb1974; 03-27-2012 at 04:45 PM.

  2. #2
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: Prevent Clng from dropping Time off returned Serial value

    I'm not a VBA expert but CLng converts a value into an Integer so that's not what you want.

    http://www.techonthenet.com/excel/formulas/clng.php
    Last edited by Cutter; 03-26-2012 at 03:14 PM. Reason: added link

  3. #3
    Forum Contributor
    Join Date
    12-10-2008
    Location
    Austin
    Posts
    660

    Re: Prevent Clng from dropping Time off returned Serial value

    Cutter, thanks for the reply.

    I've decided to use DateDiff. I've discovered that this works quite well. No need to use Clng to change to a serial value.

    BDB

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1