मुख्य सामग्री पर जाएं

Excel में डुप्लिकेट पंक्तियों को दूसरी शीट पर कैसे ले जाएँ?

लेखक: ज़ियाओयांग अंतिम संशोधित: 2022-08-09

यदि आपके पास डेटा रेंज की एक सूची है जिसमें एक विशिष्ट कॉलम में कुछ डुप्लिकेट मान शामिल हैं, तो अब, आप डुप्लिकेट कोशिकाओं के आधार पर पूरी पंक्तियों को दूसरी शीट पर ले जाना चाहते हैं। आप एक्सेल में इस कार्य से कैसे निपट सकते हैं?

किसी कॉलम में डुप्लिकेट सेल के आधार पर पूरी पंक्तियों को दूसरी शीट पर ले जाएं

डुप्लिकेट पंक्तियों के आधार पर संपूर्ण पंक्तियों को दूसरी शीट पर ले जाएँ


किसी कॉलम में डुप्लिकेट सेल के आधार पर पूरी पंक्तियों को दूसरी शीट पर ले जाएं

यदि किसी कॉलम में डुप्लिकेट मान हैं, तो पूरी पंक्तियों को दूसरी शीट पर ले जाएं, निम्नलिखित वीबीए कोड आपके काम आ सकता है:

1. दबाए रखें ALT + F11 कुंजी को खोलने के लिए अनुप्रयोगों के लिए माइक्रोसॉफ्ट विज़ुअल बेसिक खिड़की.

2। क्लिक करें सम्मिलित करें > मॉड्यूल, और मॉड्यूल विंडो में निम्नलिखित कोड पेस्ट करें।

वीबीए कोड: एक कॉलम में डुप्लिकेट सेल के आधार पर पूरी पंक्तियों को दूसरी शीट पर ले जाएं:

Sub CutDuplicates()
'Updateby Extendoffice
    Dim xRgS As Range
    Dim xRgD As Range
    Dim I As Long, J As Long
    On Error Resume Next
    Set xRgS = Application.InputBox("Please select the column:", "KuTools For Excel", Selection.Address, , , , , 8)
    If xRgS Is Nothing Then Exit Sub
    Set xRgD = Application.InputBox("Please select a desitination cell:", "KuTools For Excel", , , , , , 8)
    If xRgD Is Nothing Then Exit Sub
    xRows = xRgS.Rows.Count
    J = 0
    For I = xRows To 1 Step -1
        If Application.WorksheetFunction.CountIf(xRgS, xRgS(I)) > 1 Then
            xRgS(I).EntireRow.Copy xRgD.Offset(J, 0)
            xRgS(I).EntireRow.Delete
            J = J + 1
        End If
    Next
End Sub

3। फिर दबायें F5 इस कोड को चलाने के लिए कुंजी, और पॉप आउट डायलॉग बॉक्स में, उस कॉलम का चयन करें जिसमें डुप्लिकेट सेल हैं जिनके आधार पर आप स्थानांतरित करना चाहते हैं, स्क्रीनशॉट देखें:

4। तब दबायें OK, दूसरे प्रॉम्प्ट बॉक्स में, कृपया किसी अन्य शीट में एक सेल का चयन करें जहाँ आप स्थानांतरित पंक्तियाँ रखना चाहते हैं, स्क्रीनशॉट देखें:

5। और फिर क्लिक करें OK, जिन पंक्तियों में कॉलम ए में डुप्लिकेट मान हैं उन्हें एक नई शीट में ले जाया गया है, स्क्रीनशॉट देखें:


डुप्लिकेट पंक्तियों के आधार पर संपूर्ण पंक्तियों को दूसरी शीट पर ले जाएँ

यदि आप डुप्लिकेट पंक्तियों को कक्षों की श्रेणी से स्थानांतरित करना चाहते हैं, तो निम्नलिखित VBA कोड आपकी सहायता कर सकता है:

1. दबाए रखें ALT + F11 कुंजी को खोलने के लिए अनुप्रयोगों के लिए माइक्रोसॉफ्ट विज़ुअल बेसिक खिड़की.

2। क्लिक करें सम्मिलित करें > मॉड्यूल, और मॉड्यूल विंडो में निम्नलिखित कोड पेस्ट करें।

वीबीए कोड: डुप्लिकेट पंक्तियों के आधार पर संपूर्ण पंक्तियों को दूसरी शीट पर ले जाएं:

Sub CutDuplicates()
'Updateby Extendoffice
    Dim xRgD As Range, xRgS As Range
    Dim I As Long, J As Long, K As Long, KK As Long
    On Error Resume Next
    Set xRgS = Application.InputBox("Please select the data range:", "KuTools For Excel", Selection.Address, , , , , 8)
    If xRgS Is Nothing Then Exit Sub
    Set xRgD = Application.InputBox("Please select a desitination cell:", "KuTools For Excel", , , , , , 8)
    If xRgD Is Nothing Then Exit Sub
    KK = 0
    For I = xRgS.Rows.Count To 1 Step -1
        For J = 1 To I - 1
            For K = 1 To xRgS.Columns.Count
                Debug.Print xRgS.Rows(I).Cells(, K).Value
                Debug.Print xRgS.Rows(J).Cells(, K).Value
                If xRgS.Rows(I).Cells(, K).Value <> xRgS.Rows(J).Cells(, K).Value Then Exit For
            Next
            If K = xRgS.Columns.Count + 1 Then
                xRgS.Rows(I).EntireRow.Copy xRgD.Offset(KK, 0).EntireRow
                xRgS.Rows(I).EntireRow.Delete
                KK = KK + 1
            End If
        Next
    Next
End Sub

3। फिर दबायें F5 इस कोड को चलाने के लिए कुंजी, पॉप आउट संवाद बॉक्स में, उस डेटा श्रेणी का चयन करें जिसे आप डुप्लिकेट पंक्तियों को स्थानांतरित करना चाहते हैं, स्क्रीनशॉट देखें:

4। क्लिक करें OK बटन, और फिर दूसरे प्रॉम्प्ट बॉक्स में, एक नई शीट में एक सेल का चयन करें जहाँ आप स्थानांतरित सप्लिकेट पंक्तियाँ रखना चाहते हैं, स्क्रीनशॉट देखें:

5। तब दबायें OK बटन, और अब, डुप्लिकेट पंक्तियों को तुरंत आपके द्वारा निर्दिष्ट दूसरी शीट में ले जाया गया है, स्क्रीनशॉट देखें:

सर्वोत्तम कार्यालय उत्पादकता उपकरण

🤖 कुटूल्स एआई सहयोगी: निम्न के आधार पर डेटा विश्लेषण में क्रांति लाएं: बुद्धिमान निष्पादन   |  कोड जनरेट करें  |  कस्टम फ़ॉर्मूले बनाएं  |  डेटा का विश्लेषण करें और चार्ट बनाएं  |  कुटूल फ़ंक्शंस का आह्वान करें...
लोकप्रिय सुविधाएँ: डुप्लिकेट ढूंढें, हाइलाइट करें या पहचानें   |  रिक्त पंक्तियाँ हटाएँ   |  डेटा खोए बिना कॉलम या सेल को संयोजित करें   |   फॉर्मूला के बिना गोल ...
सुपर लुकअप: एकाधिक मानदंड VLookup    मल्टीपल वैल्यू वीलुकअप  |   अनेक शीटों में VLookup   |   फजी लुकअप ....
उन्नत ड्रॉप-डाउन सूची: शीघ्रता से ड्रॉप डाउन सूची बनाएं   |  आश्रित ड्रॉप डाउन सूची   |  बहु-चयन ड्रॉप डाउन सूची ....
स्तम्भ प्रबंधक: कॉलमों की एक विशिष्ट संख्या जोड़ें  |  कॉलम ले जाएँ  |  छिपे हुए कॉलम की दृश्यता स्थिति टॉगल करें  |  रेंज और कॉलम की तुलना करें ...
फीचर्ड फीचर्स: ग्रिड फोकस   |  डिजाइन देखें   |   बड़ा फॉर्मूला बार    कार्यपुस्तिका एवं शीट प्रबंधक   |  संसाधन लाइब्रेरी (ऑटो टेक्स्ट)   |  खजूर बीनने वाला   |  कार्यपत्रकों को संयोजित करें   |  एन्क्रिप्ट/डिक्रिप्ट सेल    सूची के अनुसार ईमेल भेजें   |  सुपर फ़िल्टर   |   विशेष फ़िल्टर (फ़िल्टर बोल्ड/इटैलिक/स्ट्राइकथ्रू...) ...
शीर्ष 15 टूलसेट12 टेक्स्ट टूल्स (पाठ जोड़ें, अक्षर हटाएँ, ...)   |   50 + चार्ट प्रकार (गैन्ट चार्ट, ...)   |   40+ प्रैक्टिकल सूत्र (जन्मदिन के आधार पर आयु की गणना करें, ...)   |   19 निवेशन टूल्स (QR कोड डालें, पथ से चित्र सम्मिलित करें, ...)   |   12 रूपांतरण टूल्स (शब्दों को संख्याएँ, मुद्रा रूपांतरण, ...)   |   7 विलय और विभाजन टूल्स (उन्नत संयोजन पंक्तियाँ, विभाजन कोशिकाओं, ...)   |   ... और अधिक

एक्सेल के लिए कुटूल के साथ अपने एक्सेल कौशल को सुपरचार्ज करें, और पहले जैसी दक्षता का अनुभव करें। एक्सेल के लिए कुटूल उत्पादकता बढ़ाने और समय बचाने के लिए 300 से अधिक उन्नत सुविधाएँ प्रदान करता है।  वह सुविधा प्राप्त करने के लिए यहां क्लिक करें जिसकी आपको सबसे अधिक आवश्यकता है...

Description


ऑफिस टैब ऑफिस में टैब्ड इंटरफ़ेस लाता है, और आपके काम को बहुत आसान बनाता है

  • Word, Excel, PowerPoint में टैब्ड संपादन और रीडिंग सक्षम करें, प्रकाशक, एक्सेस, विसियो और प्रोजेक्ट।
  • नई विंडो के बजाय एक ही विंडो के नए टैब में एकाधिक दस्तावेज़ खोलें और बनाएं।
  • आपकी उत्पादकता 50% बढ़ जाती है, और आपके लिए हर दिन सैकड़ों माउस क्लिक कम हो जाते हैं!
Comments (6)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Hola buenas,

Tenia una pregunta con respecto a esta macro; Esta macro es exactamente lo que necesito y funciona perfectamente, pero mi problema es que solo funciona en grupo de datos que no sean muy grandes.

Cuando la aplico sobre un grupo de datos grandes (en mi caso, 50mil filas), excel inevitablemente colapsa; He probado muchas cosas pero sigue colapsando.

Hay alguna manera de hacer que la macro funcione en estos casos? alguna idea? Gracias de antemano.

Rafael.
This comment was minimized by the moderator on the site
Hello, Rafael

Yes, as you said, if the data is large, the vba code will not work perfectly. In this case, you can use the auxiliary column to mark the duplicate row first, then use the filter function to filter out the duplicate row, finally copy the duplicate row to another worksheet. Please see the below demo:
To find the duplicate rows, please apply this formula: =IF(COUNTIFS($A$2:$A2,$A2,$B$2:$B2,$B2,$C$2:$C2,$C2) >1, "Duplicate row", "")
If you just want to find the duplicate cells in one column, please apply this formula: =IF(COUNTIFS($A$2:$A2,$A2) >1, "Duplicate row", "")
https://www.extendoffice.com/images/stories/comments/comment-skyyang/move-duplicates.gif
Please have a try, hope it can help you!
This comment was minimized by the moderator on the site
Hola, que tal,

Tengo una duda con respecto a esta macro; La macro funciona perfectamente y es justo lo que necesito, el problema es que habitualmente necesito utilizarla con tablas de excel en las que hay como mas de 50 mil entradas.

Al utilizarla, Excel inevitablemente se colapsa y no responde.

Hay alguna manera de conseguir que esta macro funcione en estos casos? O quizas, conseguir alguna formula/combinacion de formulas en excel que haga lo mismo? Lo comento porque en el caso de las formulas, normalmente excel no suele tardar tanto en procesar y lo resuelve mas rapido.

Un saludo, y gracias.

Rafael.
This comment was minimized by the moderator on the site
For some reason. This worked once, but I cant run it again. IT keeps timing out. Any tips?
This comment was minimized by the moderator on the site
It's working bro!!!!! Thanks.
This comment was minimized by the moderator on the site
This is exactly what I was looking for, thank you! I did it wrong the first few times and then it kept freezing. But once I did it exactly like the screenshots (selecting the exact range, copy/pasting the headers in the other sheet, and only selecting the first field under the first header) the macros was instantaneous.
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations