+ Reply to Thread
Results 1 to 9 of 9

Formula to remove invalid times?

  1. #1
    Registered User
    Join Date
    10-07-2011
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    7

    Formula to remove invalid times?

    I'm trying to get rid of times that aren't in the proper 24 hour format. Every first flight # of a group of flight #'s is the correct one, outlined in red below. I need to remove all of the rest of the false strings with improper time information. I have attatched a CSV file with the info. Example:
    23,JFK,GVA,19:35pm,9:40am,8:05,333,3857
    23,JFK,GVA,31:35pm,9:40am,8:05,333,3857
    23,JFK,GVA,43:35pm,9:40am,8:05,333,3857
    17,JFK,ZRH,17:50pm,8:05am,8:15,333,3925
    15,JFK,ZRH,20:55pm,10:50am,7:55,333,3925
    15,JFK,ZRH,32:55pm,10:50am,7:55,333,3925
    15,JFK,ZRH,44:55pm,10:50am,7:55,333,3925
    22,GVA,JFK,12:10pm,14:50pm,8:40,333,3857

    The colored strings are the correct strings and is what I need to isolate in the rest of the data, everything between that I need to either completely erase/bypass. Hopefully I will be left with all of the flights with times within the 24hr time format
    Attached Files Attached Files
    Last edited by russianspd; 10-08-2011 at 10:09 PM.

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,425

    Re: Formula to remove invalid times?

    In cell I2, put the formula:

    =IF(A2=A1,"Delete","")

    and fill down.

    Then filter on column I for "delete"

    Delete the visible rows.

    Regards
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Registered User
    Join Date
    10-07-2011
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Formula to remove invalid times?

    Just want to clarify i'm trying to delete the rows with the times that are not in 24 hour format. The formula will do so?

  4. #4
    Valued Forum Contributor tlafferty's Avatar
    Join Date
    04-08-2011
    Location
    United States, Tacoma, WA
    MS-Off Ver
    Excel 2010, Excel 2013 Customer Preview
    Posts
    1,112

    Re: Formula to remove invalid times?

    Use this formula in helper columns, then filtere for those records that are TRUE (not 24 hr time)
    Please Login or Register  to view this content.
    .
    If your question has been satisfactorily addressed, please consider marking it solved. Click the Thread Tools dropdown and select Mark thread as solved.
    Also, you might want to add to the user's reputation by clicking the star icon in the lower left corner of the post with the answer- it's why we do what we do...

    Thomas Lafferty
    Analyst/Programmer

  5. #5
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,425

    Re: Formula to remove invalid times?

    You said the first in a sequence was valid, subsequent entries are invalid. If that's the case, this helper formula will do that. It will generate "delete" whenever the entry in column A is repeated. Filter on that and do as instructed ... delete them.

    Regards

  6. #6
    Registered User
    Join Date
    10-07-2011
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Formula to remove invalid times?

    Maybe I worded it wrong. Row 1 is correct. Rows 2-18 are incorrect because the times located in columns D and E are not in 24hour format. The next flight # which is 17 in row 19 is correct. Flight 15 for row 20 is correct but rows 21-31 are not because of the time issue again. Can I change the helper formula and then filter to only select rows with times in 24hour format?

    Thanks for your help

  7. #7
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,425

    Re: Formula to remove invalid times?

    Have you actually put either of the formulae into your spreadsheet and checked the results?

    See the example.

    Regards

  8. #8
    Registered User
    Join Date
    10-07-2011
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Formula to remove invalid times?

    Using Tlefferty's method it did work, I appreciate BOTH of you guy's help. I had been struggling with this issue for a couple days. I take it you but in both formulas? One in clumn I and J? I'll give that a try

  9. #9
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,425

    Re: Formula to remove invalid times?

    I'm a little concerned that there are strange times in column E. Are they acceptable?

    Whatever, if you have a solution that meets your needs, our work is done

    If this has answered your question, or at least pointed you in the right direction, please mark your thread as solved. See my signature for details or the FAQ.

    Regards

+ 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