+ Reply to Thread
Results 1 to 7 of 7

Macro to Sort/Filter

  1. #1
    Registered User
    Join Date
    03-20-2012
    Location
    Paris
    MS-Off Ver
    Excel 2007
    Posts
    4

    Macro to Sort/Filter

    Hi all,

    I have a database that look like this:

    A B C D E F
    Date.a value.a Date.b Value.b Date.c Value.c

    The dates between A C and E are not always the same. Sometimes a date is skipped in one of the colums so the lines do not match (it's not necessarly the same date on line X for a/b/c).

    I want to arrive to a result like this:

    G H I J
    Date value.a value.b value.c

    With only the dates where I have a value for all 3 columns.

    As of now I do it manually trough this process:
    - I add a column with all the dates (the starting and ending point is the same for all columns)
    - I use a Vlookup formula to get all the values
    - I delete the empty ones (N/A) using a filter.
    - I rerank the range using descending dates.

    I wonder If I could use a macro to do all this in one shot.

    Thank you for your help!
    Attached is an exerpt of the file I'm working on.
    Attached Files Attached Files

  2. #2
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Macro to Sort/Filter

    If i understand your request right, only those dates which have entries in all 3 groups (A, B & C) should be listed, right?

    Dates which have entries in only 1 or 2 out of the 3 groups should be excluded, right?
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  3. #3
    Registered User
    Join Date
    03-20-2012
    Location
    Paris
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Macro to Sort/Filter

    Exactly yes.

    Sorry if I didn't make myself clear in the first message. English is not my first language.

  4. #4
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: Macro to Sort/Filter

    Hi anassboum. Try it
    Please Login or Register  to view this content.
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    03-20-2012
    Location
    Paris
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Macro to Sort/Filter

    Thanks a million nilem it is exactly what I was looking for, Thank you Friend of the Internet!!

    Could you please explain in a few words what this part of the code does?

    Please Login or Register  to view this content.

  6. #6
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: Macro to Sort/Filter

    In this part of the code we remove cells with '#N/A'. Run this code and see what happens on the active worksheet.
    Please Login or Register  to view this content.
    Last edited by nilem; 03-27-2012 at 01:42 PM. Reason: GoTo instead of Exit For

  7. #7
    Registered User
    Join Date
    03-20-2012
    Location
    Paris
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Macro to Sort/Filter

    I adapted it to my master file and it is working as I wanted!
    Thank you for you help!

    Cheers!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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