+ Reply to Thread
Results 1 to 2 of 2

Need help sorting sheet based on earliest time

  1. #1
    Registered User
    Join Date
    07-31-2023
    Location
    Washington, DC
    MS-Off Ver
    Version 2306
    Posts
    2

    Need help sorting sheet based on earliest time

    Hi all,

    I've been working on an automation project where I webscrape data from travel sites and have them pasted into an Excel doc. Once all of the data has been entered into the Excel doc I would like to then sort the entire Sheet based on the Departure Time column (earliest departure to latest departure). Normally this wouldn't be very challenging, however when the data is scraped and pasted into the document it seems to be entering the times in different formats.

    I am scraping data from 2 different sites, one is for flights and the other is for trains. The flights data is pasted into the document in the format "MM/dd/yyyy hh:mm:ss AM/PM". For the train data, I first need to convert it using Text to Column in order for Excel to recognize it as a time. Once that has been completed, Excel recognizes it in the format of "hh/mm/ss AM/PM".

    I am able to then Format both columns into the format of "h:mm AM/PM". On the surface, everything looks correct. However, when I then try to sort the sheet based on departure time, it does not sort properly because the Excel doc still recognizes the data based on the original time formats rather than the new format.

    I've attached an example of the Excel doc that I'm working with. If someone could take a look and help me figure out the steps necessary to solve the problem I would greatly appreciate it!

    Please let me know if any additional information is needed.

    Travel.xlsx

  2. #2
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,612

    Re: Need help sorting sheet based on earliest time

    An option,
    After you paste the train data, enter the current date in an unused cell like L1. Copy it and select the train dept/arr time cells, paste special: ADD. If the date is of no consequence, you could SUBTRACT from the flight dep/arr times
    Ben Van Johnson

+ 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. Find earliest and latest time based on specific date
    By klturi421 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 08-05-2019, 11:20 PM
  2. [SOLVED] sorting a unique list by earliest to latest date
    By cnak in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-30-2019, 02:28 PM
  3. [SOLVED] Macro to find the Earliest Start Time and Latest Finish Time during a period
    By rehana402003 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-04-2018, 06:40 AM
  4. Calculate time taken from earliest start time and latest end time
    By escapes88 in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 04-13-2018, 05:43 AM
  5. Help with sorting dates from earliest to latest
    By probuddha in forum Excel General
    Replies: 11
    Last Post: 06-15-2015, 03:53 PM
  6. Replies: 3
    Last Post: 08-31-2014, 06:39 AM
  7. Return the Earliest time in a range based on a min value
    By afgoody in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 07-24-2014, 01:21 AM

Tags for this Thread

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