Robotic Process Automation (RPA)

 View Only
Expand all | Collapse all

Get duplicate values from an Excel column

  • 1.  Get duplicate values from an Excel column

    Posted Tue May 28, 2024 12:19 PM

    Hi,

    How can I get duplicate values from a column Excel, for Example, the column looks like this:

    I just need this

    Thanks for your help



    ------------------------------
    Alex Virrueta
    ------------------------------


  • 2.  RE: Get duplicate values from an Excel column

    Posted Wed May 29, 2024 02:27 AM

    Hi,

    I am not aware of a way how to remove duplicates directly with IBM RPA actions (maybe some complicated loop), however, you can run an Office Macro.

        Dim ws As Worksheet
        Set ws = ActiveSheet
        
        ' Define the range where duplicates need to be removed
        Dim rng As Range
        Set rng = ws.Range("A1:A" & ws.Cells(ws.Rows.Count, "A").End(xlUp).Row)
        
        ' Remove duplicates in the defined range
        rng.RemoveDuplicates Columns:=1, Header:=xlYes ' Change Header to xlNo if there is no header row

    Example of macro(s) is also here: https://stackoverflow.com/questions/61182776/how-do-i-delete-duplicated-rows-in-vba



    ------------------------------
    Milan Babčanec
    ------------------------------