+ Reply to Thread
Results 1 to 9 of 9

difficult filter/sort

Hybrid View

  1. #1
    Registered User
    Join Date
    10-31-2010
    Location
    clydebank, scotland
    MS-Off Ver
    Excel 2003
    Posts
    15

    Exclamation difficult filter/sort

    I have attached a file showing several fields with the headings starting at row1 column 1.
    I would like to filter out the rows of data where the IDNumber has no blanks below them.

    This is because I want to show rows wher there is an IDNumber and the blanks below because they are the IDs of people who have worked for different departments.

    The original spreadsheets may have a copule of thousand rows in them.

    Thanks very much for your help in this
    Attached Files Attached Files

  2. #2
    Registered User
    Join Date
    03-23-2011
    Location
    spain
    MS-Off Ver
    Excel 2003/2007
    Posts
    30

    Re: difficult filter/sort

    use delimated txt process for that .paste data in excel and select first colum,press ALT+D+E
    Then select delmated option.use space optn as target then it comes in right as oyu need

  3. #3
    Valued Forum Contributor realniceguy5000's Avatar
    Join Date
    03-20-2008
    Location
    Fl
    MS-Off Ver
    Excel 2003 & 2010
    Posts
    951

    Re: difficult filter/sort

    Hi,

    can you just post an example workbook?

    This text file has a lot to be desired.

    I'm sure you may get someone to help you ,if you can give some good feedback.



    ...
    Thank You, Mike

    Some Helpful Hints:

    1. New members please read & follow the Forum Rules
    2. Use Code Tags...Place[code]Before the first line and[/code] After the last line.
    3. If you are pleased with a solution mark your post SOLVED.
    4. Thank those who have help you by clicking the scales at the top right of the post.

    Here...

  4. #4
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: difficult filter/sort

    Tomas mcD,

    Attached is a sample file based on the sample data you provided. It contains a button named "Filter" which is assigned to the following macro:
    Sub FilterMacro_for_Tomas_mcD()
        
        Dim rngID As Range: Set rngID = Range("A2", Cells(Rows.Count, "A").End(xlUp))
        
        Dim IDCell As Range, RowsToHide As Range
        For Each IDCell In rngID
            If IDCell.Value = vbNullString _
            Or IDCell.Offset(1, 0).Value = vbNullString _
            And IDCell.Offset(1, 2).Value <> vbNullString Then
            Else
                If RowsToHide Is Nothing Then
                    Set RowsToHide = IDCell
                Else
                    Set RowsToHide = Union(RowsToHide, IDCell)
                End If
            End If
        Next IDCell
        
        RowsToHide.EntireRow.Hidden = True
        
    End Sub


    Hope that helps,
    ~tigeravatar
    Attached Files Attached Files
    Last edited by tigeravatar; 06-30-2011 at 03:55 PM.

  5. #5
    Registered User
    Join Date
    10-31-2010
    Location
    clydebank, scotland
    MS-Off Ver
    Excel 2003
    Posts
    15

    Re: difficult filter/sort

    I have attached a file showing several fields with the headings starting at row1 column 1.
    I would like to filter out the rows of data where the IDNumber has no blanks below them.

    This is because I want to show rows wher there is an IDNumber and the blanks below because they are the IDs of people who have worked for different departments.

    The original spreadsheets may have a copule of thousand rows in them.

    Thanks very much for your help in this

    I have attached an excel spreadsheet this time
    Attached Files Attached Files

  6. #6
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: difficult filter/sort

    Tomas mcD,

    Based on the excel sample workbook you provided, I updated the macro to the following:
    Sub FilterMacro_for_Tomas_mcD()
        
        Dim rngID As Range: Set rngID = Range("A2", Cells(Rows.Count, "A").End(xlUp))
        
        Dim IDCell As Range, RowsToHide As Range
        For Each IDCell In rngID
            If IDCell.Value = vbNullString _
            Or IDCell.Offset(1, 0).Value = vbNullString _
            And IDCell.Offset(1, 2).Value <> vbNullString Then
            Else
                If RowsToHide Is Nothing Then
                    Set RowsToHide = IDCell
                Else
                    Set RowsToHide = Union(RowsToHide, IDCell)
                End If
            End If
        Next IDCell
        
        RowsToHide.EntireRow.Hidden = True
        
    End Sub


    Hope that helps,
    ~tigeravatar

  7. #7
    Registered User
    Join Date
    10-31-2010
    Location
    clydebank, scotland
    MS-Off Ver
    Excel 2003
    Posts
    15

    Re: difficult filter/sort

    Quote Originally Posted by realniceguy5000 View Post
    Hi,

    can you just post an example workbook?

    This text file has a lot to be desired.

    I'm sure you may get someone to help you ,if you can give some good feedback.



    ...
    Thanks vry much problem solved

  8. #8
    Registered User
    Join Date
    10-31-2010
    Location
    clydebank, scotland
    MS-Off Ver
    Excel 2003
    Posts
    15

    Re: difficult filter/sort

    how do i mark it as solved

  9. #9
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: difficult filter/sort

    1. In your original post, click "Edit"
    2. Advanced
    3. Change Prefix to [Solved]

+ 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