+ Reply to Thread
Results 1 to 4 of 4

Dataset: count and return if user has both R1 and R2

  1. #1
    Registered User
    Join Date
    03-27-2009
    Location
    Wold
    MS-Off Ver
    Excel 2003
    Posts
    4

    Dataset: count and return if user has both R1 and R2

    Hey all, I am looking working on the following and all I can do so far is delete duplicates...to get a global count. Can anyone help me?


    I have the following dataset:
    Formating is not working but each of the following (users and Rights) are in seperate columns

    Column1 Column2
    Users User Rights
    X R1
    X R1
    X R1
    X R1
    X R1
    X R1
    X R2
    X1 R1
    X1 R1
    X1 R1
    X1 R1
    X1 R1
    X1 R1


    What I am looking for is a simple way of extracting user X because he has both R1 and R2 in the column. I don't want to extract X1 because he doesn't have R1 and R2 he only has R1.

    Does this make sense? can anyone help me? My greatest attempt so far was the ability to delete duplicate entries which I plan to use later in my macro.

    Conversly, I would be just as happy to delete user X1 from the current dataset...
    Last edited by rchxenson; 03-27-2009 at 10:49 AM.

  2. #2
    Registered User
    Join Date
    03-27-2009
    Location
    Wold
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Dataset: count and return if user has both R1 and R2

    so I believe I need to build an array for the user names and the check the array for both X and X1, if the result is true, we can keep, if the result is false, delete the array (which I would hope would delete the contents in the excel document).

    Any one know if I am on the right track even?

  3. #3
    Registered User
    Join Date
    03-27-2009
    Location
    Wold
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Dataset: count and return if user has both R1 and R2

    so I made this to delete those that are X1 but the problem is I don't want to delete X1 unless it matches the argument described above....

    I would like the 'X1' to be filled with something that comes from an array or I would like to build into this something that would check column B, containing the R1 and R1. For instance if

    for each unique in Column A
    Column B contains R1 and R2
    False = delete

    Does this help anyone understand better? I am a clutz at VB



    Sub Delete_Items()
    Application.ScreenUpdating = False
    Application.DisplayStatusBar = True

    For Each ws In Sheets
    ws.Activate


    Dim LR As Long, i As Long
    LR = Range("A" & Rows.Count).End(xlUp).Row
    For i = LR To 1 Step -1
    If Range("A" & i).Value = "X1" Then Rows(i).Delete
    Next i


    Next ws
    Application.StatusBar = False
    Application.ScreenUpdating = True
    End Sub

  4. #4
    Registered User
    Join Date
    03-27-2009
    Location
    Wold
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Dataset: count and return if user has both R1 and R2

    I have attached an example of a spreadsheet and result I am looking for
    Attached Files Attached Files

+ 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