Vlookup, removing duplicates

great123

New Member
Joined
Jul 29, 2013
Messages
8
A.How to remove duplicate Invoices (I) rows? Like in Column B the type shows whether it is Invoice(I) or Order (O).

For mulitple invoices with the same number I have to keep only 1 and delete the rest.

like for number 1061058, there are 8 invoices, I have to keep only 1.

is there any formula instead of using remove duplicate function?

NUMBERTYPESTORECLONED_TOCLONED_FROM
1061058I001
1061058I001
1061058I001
1061058I001
1061058I001
1061058I001
1061058I001
1061058I001
1061453I001
1061453I001
1062192I001
1062192I001
1062192I001
1062192I001
1062192I001
1062192I001
1062192I001
1062192I001
1062233I001
1062252I001 3000629
1062252I001 3000629
1062252I001 3000629
1062252I001 3000629
1062252I001 3000629
1062252I001 3000629
1062252I001 3000629
1062252I001 3000629
1062252I001 3000629
1062252I001 3000629
1062252I001 3000629
1062252I001 3000629
1062252I001 3000629
1062252I001 3000629

<colgroup><col><col><col><col><col></colgroup><tbody>
</tbody>


B. I want to check which invoices numbers are matching with the number in Cloned_from column?

NUMBERTYPESTORECLONED_TOCLONED_FROM
1061058I001
1063077I001 1063080
1063078I001 1063077
1063079I001 1063077
1063080I001 1063077

<colgroup><col><col><col><col><col></colgroup><tbody>
</tbody>

Any formula?

Plz reply for A & B.
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
Hi

Here's a VBA solution to part A:

Code:
Sub Remove_Duplicate_Invoices()
    n = Range("B" & Rows.Count).End(xlUp).Row
    For i = n To 2 Step -1
        If Cells(i, 2).Value = "I" Then
            Range("A2:A" & i).Name = "r_one"
            Range("B2:B" & i).Name = "r_two"
            Range("A" & i).Name = cell
            If i > [MIN(IF(r_two="I",IF(r_one=cell,ROW(r_one))))] Then
                Cells(i, 1).EntireRow.Delete
            End If
        End If
    Next i
End Sub
Test in a practice workbook first.

As for part B, I'm not quite sure what you are looking for. What do you want the end result to be?

Hope this helps,

Chris.
 
Upvote 0
EDIT: In my previous post, the line...

Code:
Range("A" & i).Name = cell
... should have been...

Code:
Range("A" & i).Name = "cell"
Chris.
 
Upvote 0
EDIT: In my previous post, the line...

Code:
Range("A" & i).Name = cell
... should have been...

Code:
Range("A" & i).Name = "cell"
Chris.

Hi,

Thank you for your reply..

I don't know about VBA. is there a way to use this formula in Excel?

Thanks alot
 
Upvote 0
You could use the formula in an adjacent column.

So it would be:

Code:
=IF(B2<>"I","",IF(MIN(IF($A$2:$A$55555=A2,IF($B$2:$B$55555=B2,ROW($A$2:$A$55555)))){less than symbol}ROW(A2),"DELETE",""))
<row(a2),"delete",""))"
<row(a2),"delete",""))[ code]
Entered with CTRL+SHIFT+ENTER.

(You need to replace {less than symbol} with the "less than" symbol.)

So you could use this formula in column F, and it would show which rows need to be deleted. You could then filter on column F for "DELETE", and delete those rows. Make sure to use "Select Only Visible Cells" when you do this, which will prevent any of the now hidden (by the filter) rows from being deleted.

"Select Only Visible Cells" needs to be added to the Quick Access Toolbar in Options; a quick Google search will provide information on how to do this.

Hope this helps,

Chris.</row(a2),"delete",""))[></row(a2),"delete",""))"
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,430
Messages
6,119,443
Members
448,898
Latest member
drewmorgan128

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top