---
title: "How to remove common values in Excel under different rows?"  
description: "How to remove common values in Excel under different rows?"  
author: "Steilla Mitchel"  
published: 2023-08-22  
updated: 2023-08-23  
canonical: https://www.mindstick.com/forum/159631/how-to-remove-common-values-in-excel-under-different-rows  
category: "excel"  
tags: ["excel"]  
reading_time: 2 minutes  

---

# How to remove common values in Excel under different rows?

How to [remove](https://yourviews.mindstick.com/story/4554/8-harmful-weeds-to-remove-from-garden) [common](https://www.mindstick.com/articles/23170/10-most-common-accounting-mistakes-of-small-business) [values](https://www.mindstick.com/forum/327/sum-textbox-values) in [Excel](https://www.mindstick.com/articles/12937/how-to-import-excel-data-in-sql-server-2014) under different rows?

## Replies

### Reply by Aryan Kumar

There are a few ways to remove common values in Excel under different rows.

## Using the Remove Duplicates feature:

1. Select the range of cells that you want to remove the common values from.
2. Click on the **Data** tab.
3. In the **Data Tools** group, click on the **Remove Duplicates** button.
4. In the **Remove Duplicates** dialog box, select the columns that you want to remove the duplicates from.
5. Click on the **OK** button.

## Using the Advanced Filter feature:

1. Select the range of cells that you want to remove the common values from.
2. Click on the **Data** tab.
3. In the **Sort & Filter** group, click on the **Advanced** button.
4. In the **Advanced Filter** dialog box, select the **Remove Duplicates** option.
5. Select the columns that you want to remove the duplicates from.
6. Click on the **OK** button.

## Using a VBA macro:

You can also use a VBA macro to remove common values in Excel under different rows. The following is a VBA macro that you can use:

VBA

```plaintext
Sub RemoveCommonValues()

' This macro removes common values in Excel under different rows.

Dim rng As Range
Dim i As Long
Dim j As Long

' Set the range of cells that you want to remove the common values from.
Set rng = Range("A1:B10")

' For each row in the range,
For i = 1 To rng.Rows.Count

    ' For each cell in the row,
    For j = 1 To rng.Columns.Count

        ' If the value of the cell is already in the current row,
        If rng(i, j).Value In rng(i, 1:j - 1) Then

            ' Remove the value from the cell.
            rng(i, j).Value = ""

        End If

    Next j

Next i

End Sub
```

To use this macro, copy and paste it into a VBA module and then run the macro.


---

Original Source: https://www.mindstick.com/forum/159631/how-to-remove-common-values-in-excel-under-different-rows

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
