+ Reply to Thread
Results 1 to 5 of 5

Issues with Datediff

  1. #1
    Forum Contributor
    Join Date
    02-12-2011
    Location
    Hyderabad
    MS-Off Ver
    Excel 2016
    Posts
    270

    Issues with Datediff

    Hi All

    Hi All

    i am trying to find a difference between dates using a datediff function. But it say type mismatch. can you let me know
    what issue in the below code

    Please Login or Register  to view this content.
    Also is it better to use Dateserial instead of datediff
    Never confuse a single defeat to the final defeat.

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2502
    Posts
    26,771

    Re: Issues with Datediff

    The first argument, where you use Format, is not a date, it is a String built from the date in FD1. The second argument may work but just in case I would explicitly convert it to a date. Try this:

    Please Login or Register  to view this content.
    Last edited by 6StringJazzer; 03-18-2018 at 08:58 AM.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2502
    Posts
    26,771

    Re: Issues with Datediff

    DateSerial has a completely different purpose than DateDiff. DateDiff tells you the difference between two dates, and DateSerial builds a date from the year, month, and day. You can't swap one for the other.

  4. #4
    Forum Contributor
    Join Date
    02-12-2011
    Location
    Hyderabad
    MS-Off Ver
    Excel 2016
    Posts
    270

    Re: Issues with Datediff

    Hi

    just realised the datediff format by which i got the result

    DateDiff( interval, date1, date2,)

    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    02-12-2011
    Location
    Hyderabad
    MS-Off Ver
    Excel 2016
    Posts
    270

    Re: Issues with Datediff

    Thank you jazzer

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Sumproduct with datediff
    By onthecauseway in forum Excel General
    Replies: 4
    Last Post: 02-06-2012, 10:51 AM
  2. DateDiff
    By YBrazeau in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 12-31-2009, 12:09 PM
  3. DateDiff error in VB
    By vandanavai in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-15-2007, 12:21 PM
  4. DateDiff
    By vandanavai in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-20-2006, 03:12 AM
  5. DateDiff
    By RetepNamenots in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-16-2006, 04:03 PM
  6. datediff help
    By ina in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-24-2006, 04:50 AM
  7. DateDIFF
    By Paul Breslin in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-12-2005, 11:15 AM
  8. [SOLVED] Help with datediff vba
    By John in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-16-2005, 10:42 AM

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