+ Reply to Thread
Results 1 to 2 of 2

Search through data, filter based on criteria and count the values paste to new sheet

  1. #1
    Registered User
    Join Date
    06-14-2012
    Location
    India
    MS-Off Ver
    Microsoft? Excel? for Microsoft 365 MSO (Version 2307 Build 16.0.16626.20170) 64-bit
    Posts
    14

    Search through data, filter based on criteria and count the values paste to new sheet

    Dear Experts,
    I have more than 5000 rows of datas from which, I need to extract the total number of "Resolved" cases based on few criteria, copy them and paste it in another sheet Summary with respective headers and Rows.

    From the Master data, search respective
    "Technician's Name" and filter by "Case Type" which should be only "Breakdown" "Preventive Maintenance",
    then by "Category" number of "AC" and "Non AC",
    Next by (Count) Case Stage "Resolved" "Delivered"

    "Day wise" paste the total count in "Summary" Sheet having Row header with "Technician's Name", "Date" and Column headers "Resolved (AC),Resolved (Non AC), Delivered (AC)
    and Delivered (Non AC)

    Need the total count of Cases attended by each technician against every Category.

    Attached Sample workbook. Please help solution through VBA

    Thanks in advance.
    Attached Files Attached Files

  2. #2
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,481

    Re: Search through data, filter based on criteria and count the values paste to new sheet

    Try below code.

    PHP Code: 
    Option Explicit
    Sub summary
    ()
    Dim lr&, i&, j&, rngres(), pos&, sps
    Dim dic 
    As Objectitem
    Set dic 
    CreateObject("Scripting.Dictionary")
    With Sheets("Dump")
        
    lr = .Cells(Rows.Count"A").End(xlUp).Row
        rng 
    = .Range("E2:R" lr).Value
    End With
    For 1 To UBound(rng)
        
    pos IIf(rng(i14) = "Resolved"1IIf(rng(i14) = "Delivered"30))
        If 
    pos 0 Then
            pos 
    pos IIf(rng(i7) = "AC"01)
            If 
    Not dic.exists(rng(i1)) Then
                Select 
    Case pos
                    
    Case 1
                        s 
    "1-0-0-0"
                    
    Case 2
                        s 
    "0-1-0-0"
                    
    Case 3
                        s 
    "0-0-1-0"
                    
    Case 4
                        s 
    "0-0-0-1"
                
    End Select
                dic
    .Add rng(i1), s
            
    Else
                
    sp Split(dic(rng(i1)), "-")
                
    sp(pos 1) = sp(pos 1) + 1
                dic
    (rng(i1)) = Join(sp"-")
            
    End If
        
    End If
    Next
    Sheets
    ("Summary").Activate
    ReDim res
    (1 To dic.Count1 To 4): 0
    For Each item In dic.items
        i 
    1
        
    For 1 To UBound(res2)
            
    res(ij) = Split(item"-")(1)
        
    Next
    Next
    Range
    ("A2:A1000,D2:G1000").ClearContents
    Range
    ("A2").Resize(dic.Count1).Value WorksheetFunction.Transpose(dic.keys)
    Range("D2").Resize(UBound(res), UBound(res2)).Value res
    End Sub 
    Attached Files Attached Files
    Quang PT

+ 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. [SOLVED] Filter Copy and paste data in using VBA based on a criteria
    By Eustace07 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-06-2019, 12:53 PM
  2. [SOLVED] VBA to Copy & paste values from one sheet to another based on criteria.
    By rossi_69 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-05-2018, 08:04 AM
  3. VBA to Insert Formulas, Filter Data, and Paste on tab based on criteria.
    By Mr.Bigz in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-23-2018, 09:39 PM
  4. [SOLVED] Count Unique values based on 2 criteria and paste answer
    By spyac in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-15-2018, 01:04 PM
  5. [SOLVED] Search for Values that meet a Criteria and Paste Location in a New Sheet
    By jorgeflores in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 10-26-2017, 06:09 AM
  6. Filter, Copy, Paste in a new sheet and give heading based on criteria
    By saravanan1981 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-12-2016, 09:54 AM
  7. Replies: 4
    Last Post: 01-08-2013, 12:37 PM

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