Closed Thread
Results 1 to 6 of 6

Comparing two rows of Data

  1. #1
    Registered User
    Join Date
    07-15-2008
    Location
    Pembroke Pines, FL
    Posts
    2

    Comparing two rows of Data

    I have the following column headings in a ssheet:

    SECTOR ID
    ORIG
    DEST
    1ST FLT TYPE
    NSL
    MONDAY
    TUESDAY
    WEDNESDAY
    THURSDAY
    FRIDAY
    SATURDAY
    SUNDAY
    STA
    MPSTDT
    MPENDDT

    Rows are classified as CH or FS - they are one after the other.

    What Im trying to do is look thru the spreadsheet - if the sector ids are the same I need to look at Monday thru Saturday (Monday thru Saturday have numeric values in them). If the values for Monday or Tuesday or Wednesday etc. match than I need to delete all the rows with similar sector ids and concantenate NSLs into one cell and the FS into one row. The number of sector ids varies - it could be 4 similar ones or 6 etc.

    Any ideas on how a macro would do this? Ive attached a sample of the raw data vs. the finished prod. I'll appreciate any help.
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591
    Hi

    In your example file, add a new sheet called sheet1.

    Put the code below into a general module, and run. I doesn't fill out the FS column. I'm guessing that the FS comes from say the Monday column of data, but given the example output I can't be sure. I can't see where the FS of 2,77 comes from for BDLJFK02. Should it be 0,00?


    I'm also not sure if this code groups on enough data and it is a quirk of the example data that allows the results to work. Can you expand your data sample to cover a wider range if it doesn't work.


    rylo

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    07-15-2008
    Location
    Pembroke Pines, FL
    Posts
    2
    Thanks so much. It works to an extent. Im attaching a better data set with a tab that shows the expected result. Basically - Im trying to look thru the Sectors - if the sector ids match - I look at Monday thru Sunday to see if they cost the same. If they do cost the same I group the NSLs together into one cell in one row, along with the FS and CH costs and delete the extra rows.
    Attached Files Attached Files

  4. #4
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591
    Hi

    Is this the full result you expect from this data? Seems to be missing a lot. If it is right, then why was the one row selected, and all the others rejected???

    rylo

  5. #5
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,464
    CROSS POST

    Already solved in MrExcel

  6. #6
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591
    locked for cross posting with no reference.

Closed 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