A macro to filter out data and delete the rest using a mapping on another sheet

Important Notice


Please note that on 14th December 2023 users will experience an expected outage whilst we make upgrades to our network. We anticipate this process may take a couple of hours and so we apologise in advance for any inconvenience.

  • Hello,


    I want to create a macro which can search and match values in a particular column and filter out data based on it . The values that need to be searched would be present in another sheet.The rest data that does not match the criteria are to be deleted(entire rows)

  • Hello Aroy,


    Here's another method:-



    The code uses a helper sheet (Sheet3) to temporarily store the required data for an instant. It is then cleared.


    I hope that this helps.


    Cheerio,
    vcoolio.

  • Hi Aroy,


    Pl try this code. The file is also attached. You can delete the sheet 'Data'


  • Thnak You fro your response guys. I am trying out @B Rama Krishna's code first..just needed a little tweak..i want to a filter first for column A in sheet 1..say the values are Data,Data 1, Data2 and I want to filter out ranges having data and data 2 as cell value and then perform the mentioned code above on that filtered out data...can you help [USER="334446"]B Rama Krishna[/USER] ?

  • Hi,


    Pl let me know if my understanding is correct. For the cell values in Col A of sheet 1


    a) Retain rows with only 'Data', 'Date1' and 'Data2'
    b) From this data remove rows with 'Data' and 'Data2' (that leaves rows with only 'Data1')
    c) then perform the matching with Col A of Sheet 2 and delete non-matching rows


    In any case would appreciate if you could send an xl sheet and explain what needs to be done, so that I can work on the same.

  • Hello Rama,


    Thank you once again.
    I sorted that out. What I wanted to do was to first filter out data from sheet 1 and then delete data from the filtered out result using the mappings.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!