+ Reply to Thread
Results 1 to 2 of 2

Finding the greatest date in a list

  1. #1
    Registered User
    Join Date
    02-17-2012
    Location
    charlotte, nc
    MS-Off Ver
    Excel 2007
    Posts
    25

    Finding the greatest date in a list

    Hello All,

    I have a loop in a code I'm working on. It is suppose to find the largest date in a list. The test data I'm using has 12/28/2013 as the highest date. But when I run the code, every time, I get 9/7/2013 is the highest date. Is there any reason for this? I have put a break in the code to check to make sure it is reading the dates correctly. It came up with the if statement saying 12/28/2013 > 9/7/2013 = false. That made no sense to me. Does anyone know what could be causing the problem? Below is my code snippet for the loop.

    Please Login or Register  to view this content.

  2. #2
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,731

    Re: Finding the greatest date in a list

    Your "dates" may be text values that just happen to look like dates. You will need to convert these to proper dates if that is the case (e.g. multiply by 1, or do Text-to-Columns, then <Finish> on the first panel).

    Incidentally, why not use the Max function ?

    Hope this helps.

    Pete

+ 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