اذهب الي المحتوي
أوفيسنا
بحث مخصص من جوجل فى أوفيسنا
Custom Search

الردود الموصى بها

قام بنشر

أخي الكريم فارس

إليك الكود التالي عله يكون المطلوب

Sub ExtractUnique_Count()
    Dim R1 As Range, R2 As Range, Cel As Range, LR As Long
    Dim D1, D2, A1, A2
    
    LR = Sheet1.Cells(Rows.Count, "B").End(xlUp).Row
    Set R1 = Sheet1.Range("B2:B" & LR)
    Set R2 = Sheet1.Range("D2:D" & LR)
    
    Set D1 = CreateObject("Scripting.Dictionary")
    Set D2 = CreateObject("Scripting.Dictionary")
    On Error Resume Next
    
    Sheet3.Range("A2:E1000").ClearContents
    For Each Cel In R1
        If Cel <> 0 Then D1.Add CStr(Cel), CStr(Cel)
    Next Cel
    A1 = D1.Items
    
    For Each Cel In R2
        If Cel <> 0 Then D2.Add CStr(Cel), CStr(Cel)
    Next Cel
    A2 = D2.Items
    
    Sheet3.Range("A2").Resize(D1.Count) = Application.Transpose(A1)
    With Sheet3.Range("B2").Resize(D1.Count)
        .Formula = "=COUNTIF(ورقة1!$B$2:$B$1000,A2)"
        .Value = .Value
    End With
    
    Sheet3.Range("D2").Resize(D2.Count) = Application.Transpose(A2)
    With Sheet3.Range("E2").Resize(D2.Count)
        .Formula = "=COUNTIF(ورقة1!$D$2:$D$1000,D2)"
        .Value = .Value
    End With
End Sub

وإليك الملف المرفق فيه تطبيق للكود

تقبل تحياتي

Extract Unique Items & Count Them YasserKhalil.rar

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

زائر
اضف رد علي هذا الموضوع....

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • تصفح هذا الموضوع مؤخراً   0 اعضاء متواجدين الان

    • لايوجد اعضاء مسجلون يتصفحون هذه الصفحه
×
×
  • اضف...

Important Information