PDA

View Full Version : Extracting Unique Data



Howardc
07-01-2012, 02:48 PM
I have data in Column A and in Column E from row 2 onwards.

1) I would like to set up a formula in column F compare the data in Column E to Column A and where data exists in Column E, but not in Column A, I would like this extracted
2) I would like to set up a formula in column G compare the data in Column A to Column E and where data exists in Column A, but not in Column E, I would like this extracted
3) I would like to set up a formula in Column H or VBA code to compare column A to Column E and extract the numbers that are unique to both

your assistance is most appreciated

littleiitin
07-01-2012, 08:41 PM
Hi,

Welcome to the board....

Plaese find the below solution...


PASTE Below formula in F2 and Drag it down:


=IF(COUNTIF($A$2:$A$18,E2)>0,E2,"")


PASTE Below formula in G2 and Drag it Down:


=IF(COUNTIF($E$2:$E$18,A2)>0,A2,"")


for Unique : You can use below formula H2 nd drag it down in:...



=IF(COUNTIF($A$2:$A$18,E2)=0,E2,IF(COUNTIF($E$2:$E $18,A2)=0,A2,""))



and Below Code is for Unique One:Below Code Will work if you have 2007 and above version..



Sub FindUnique()

Dim lngLastR As Long
Dim rngAutoFil As Range

With ThisWorkbook.Worksheets("sheet1")
lngLastR = .Range("A" & .Rows.Count).End(xlUp).Row
.Columns("I:I").Insert
.Range("A2:A" & lngLastR).Copy
.Range("H2").PasteSpecial xlPasteValues
.Range("E2:E" & .Range("E" & .Rows.Count).End(xlUp).Row).Copy
.Range("H" & lngLastR + 1).PasteSpecial xlPasteValues
Set rngAutoFil = .Range("H2:H" & .Range("H" & .Rows.Count).End(xlUp).Row)
rngAutoFil.Select
rngAutoFil.RemoveDuplicates Columns:=1, Header:=xlNo
End With
End Sub



HTH
-----------------------------

Howardc
07-04-2012, 07:43 PM
Hi

It would be appreciated if you could help me again.

I now need to compare column A & E, and need to compare col E to col A and to extract data in Col A that does not appear in Col E

Your assistance in this regar is most appreciated

bakerman
07-17-2012, 08:26 PM
IF(COUNTIF($E$2:$E$18,A2)=0,A2,"")

Howardc
07-17-2012, 09:42 PM
Thanks for the help, much appreciated